diff options
Diffstat (limited to 'src/mesa/state_tracker')
63 files changed, 876 insertions, 5284 deletions
diff --git a/src/mesa/state_tracker/acc2.c b/src/mesa/state_tracker/acc2.c deleted file mode 100644 index fa5de2b764..0000000000 --- a/src/mesa/state_tracker/acc2.c +++ /dev/null @@ -1,319 +0,0 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - - /* - * Authors: - * Brian Paul - */ - -#include "main/imports.h" -#include "main/image.h" -#include "main/macros.h" - -#include "st_context.h" -#include "st_cb_accum.h" -#include "st_cb_fbo.h" -#include "st_draw.h" -#include "st_format.h" -#include "pipe/p_context.h" -#include "pipe/p_defines.h" -#include "pipe/p_inlines.h" -#include "util/p_tile.h" - - -#define UNCLAMPED_FLOAT_TO_SHORT(us, f) \ - us = ( (short) ( CLAMP((f), -1.0, 1.0) * 32767.0F) ) - - -/** - * For hardware that supports deep color buffers, we could accelerate - * most/all the accum operations with blending/texturing. - * For now, just use the get/put_tile() functions and do things in software. - */ - - -static void -acc_get_tile_rgba(struct pipe_context *pipe, struct pipe_surface *acc_ps, - uint x, uint y, uint w, uint h, float *p) -{ - const enum pipe_format f = acc_ps->format; - const int cpp = acc_ps->cpp; - - acc_ps->format = PIPE_FORMAT_R16G16B16A16_SNORM; - acc_ps->cpp = 8; - - pipe_get_tile_rgba(pipe, acc_ps, x, y, w, h, p); - - acc_ps->format = f; - acc_ps->cpp = cpp; -} - - -static void -acc_put_tile_rgba(struct pipe_context *pipe, struct pipe_surface *acc_ps, - uint x, uint y, uint w, uint h, const float *p) -{ - enum pipe_format f = acc_ps->format; - const int cpp = acc_ps->cpp; - - acc_ps->format = PIPE_FORMAT_R16G16B16A16_SNORM; - acc_ps->cpp = 8; - - pipe_put_tile_rgba(pipe, acc_ps, x, y, w, h, p); - - acc_ps->format = f; - acc_ps->cpp = cpp; -} - - - -void -st_clear_accum_buffer(GLcontext *ctx, struct gl_renderbuffer *rb) -{ - struct pipe_context *pipe = ctx->st->pipe; - struct st_renderbuffer *acc_strb = st_renderbuffer(rb); - struct pipe_surface *acc_ps = acc_strb->surface; - const GLint xpos = ctx->DrawBuffer->_Xmin; - const GLint ypos = ctx->DrawBuffer->_Ymin; - const GLint width = ctx->DrawBuffer->_Xmax - xpos; - const GLint height = ctx->DrawBuffer->_Ymax - ypos; - const GLfloat r = ctx->Accum.ClearColor[0]; - const GLfloat g = ctx->Accum.ClearColor[1]; - const GLfloat b = ctx->Accum.ClearColor[2]; - const GLfloat a = ctx->Accum.ClearColor[3]; - GLfloat *accBuf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat)); - int i; - -#if 1 - GLvoid *map; - - map = pipe_surface_map(acc_ps); - switch (acc_strb->format) { - case PIPE_FORMAT_R16G16B16A16_SNORM: - { - GLshort r = FLOAT_TO_SHORT(ctx->Accum.ClearColor[0]); - GLshort g = FLOAT_TO_SHORT(ctx->Accum.ClearColor[1]); - GLshort b = FLOAT_TO_SHORT(ctx->Accum.ClearColor[2]); - GLshort a = FLOAT_TO_SHORT(ctx->Accum.ClearColor[3]); - int i, j; - for (i = 0; i < height; i++) { - GLshort *dst = ((GLshort *) map - + ((ypos + i) * acc_ps->pitch + xpos) * 4); - for (j = 0; j < width; j++) { - dst[0] = r; - dst[1] = g; - dst[2] = b; - dst[3] = a; - dst += 4; - } - } - } - break; - default: - _mesa_problem(ctx, "unexpected format in st_clear_accum_buffer()"); - } - - pipe_surface_unmap(acc_ps); - -#else - for (i = 0; i < width * height; i++) { - accBuf[i*4+0] = r; - accBuf[i*4+1] = g; - accBuf[i*4+2] = b; - accBuf[i*4+3] = a; - } - - acc_put_tile_rgba(pipe, acc_ps, xpos, ypos, width, height, accBuf); -#endif -} - - -/** For ADD/MULT */ -static void -accum_mad(struct pipe_context *pipe, GLfloat scale, GLfloat bias, - GLint xpos, GLint ypos, GLint width, GLint height, - struct pipe_surface *acc_ps) -{ - GLfloat *accBuf; - GLint i; - - accBuf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat)); - - pipe_get_tile_rgba(pipe, acc_ps, xpos, ypos, width, height, accBuf); - - for (i = 0; i < 4 * width * height; i++) { - accBuf[i] = accBuf[i] * scale + bias; - } - - pipe_put_tile_rgba(pipe, acc_ps, xpos, ypos, width, height, accBuf); - - free(accBuf); -} - - -static void -accum_accum(struct pipe_context *pipe, GLfloat value, - GLint xpos, GLint ypos, GLint width, GLint height, - struct pipe_surface *acc_ps, - struct pipe_surface *color_ps) -{ - GLfloat *colorBuf, *accBuf; - GLint i; - - colorBuf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat)); - accBuf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat)); - - pipe_get_tile_rgba(pipe, color_ps, xpos, ypos, width, height, colorBuf); - acc_get_tile_rgba(pipe, acc_ps, xpos, ypos, width, height, accBuf); - - for (i = 0; i < 4 * width * height; i++) { - accBuf[i] = accBuf[i] + colorBuf[i] * value; - } - - acc_put_tile_rgba(pipe, acc_ps, xpos, ypos, width, height, accBuf); - - free(colorBuf); - free(accBuf); -} - - -static void -accum_load(struct pipe_context *pipe, GLfloat value, - GLint xpos, GLint ypos, GLint width, GLint height, - struct pipe_surface *acc_ps, - struct pipe_surface *color_ps) -{ - GLfloat *buf; - GLint i; - - buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat)); - - pipe_get_tile_rgba(pipe, color_ps, xpos, ypos, width, height, buf); - - for (i = 0; i < 4 * width * height; i++) { - buf[i] = buf[i] * value; - } - - acc_put_tile_rgba(pipe, acc_ps, xpos, ypos, width, height, buf); - - free(buf); -} - - -static void -accum_return(GLcontext *ctx, GLfloat value, - GLint xpos, GLint ypos, GLint width, GLint height, - struct pipe_surface *acc_ps, - struct pipe_surface *color_ps) -{ - struct pipe_context *pipe = ctx->st->pipe; - const GLubyte *colormask = ctx->Color.ColorMask; - GLfloat *abuf, *cbuf = NULL; - GLint i, ch; - - abuf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat)); - - acc_get_tile_rgba(pipe, acc_ps, xpos, ypos, width, height, abuf); - - if (!colormask[0] || !colormask[1] || !colormask[2] || !colormask[3]) { - cbuf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat)); - pipe_get_tile_rgba(pipe, color_ps, xpos, ypos, width, height, cbuf); - } - - for (i = 0; i < width * height; i++) { - for (ch = 0; ch < 4; ch++) { - if (colormask[ch]) { - GLfloat val = abuf[i * 4 + ch] * value; - abuf[i * 4 + ch] = CLAMP(val, 0.0, 1.0); - } - else { - abuf[i * 4 + ch] = cbuf[i * 4 + ch]; - } - } - } - - pipe_put_tile_rgba(pipe, color_ps, xpos, ypos, width, height, abuf); - - free(abuf); - if (cbuf) - free(cbuf); -} - - -static void -st_Accum(GLcontext *ctx, GLenum op, GLfloat value) -{ - struct st_context *st = ctx->st; - struct pipe_context *pipe = st->pipe; - struct st_renderbuffer *acc_strb - = st_renderbuffer(ctx->DrawBuffer->Attachment[BUFFER_ACCUM].Renderbuffer); - struct st_renderbuffer *color_strb - = st_renderbuffer(ctx->ReadBuffer->_ColorReadBuffer); - struct pipe_surface *acc_ps = acc_strb->surface; - struct pipe_surface *color_ps = color_strb->surface; - - const GLint xpos = ctx->DrawBuffer->_Xmin; - const GLint ypos = ctx->DrawBuffer->_Ymin; - const GLint width = ctx->DrawBuffer->_Xmax - xpos; - const GLint height = ctx->DrawBuffer->_Ymax - ypos; - - /* make sure color bufs aren't cached */ - pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL); - - switch (op) { - case GL_ADD: - if (value != 0.0F) { - accum_mad(pipe, 1.0, value, xpos, ypos, width, height, acc_ps); - } - break; - case GL_MULT: - if (value != 1.0F) { - accum_mad(pipe, value, 0.0, xpos, ypos, width, height, acc_ps); - } - break; - case GL_ACCUM: - if (value != 0.0F) { - accum_accum(pipe, value, xpos, ypos, width, height, acc_ps, color_ps); - } - break; - case GL_LOAD: - accum_load(pipe, value, xpos, ypos, width, height, acc_ps, color_ps); - break; - case GL_RETURN: - accum_return(ctx, value, xpos, ypos, width, height, acc_ps, color_ps); - break; - default: - assert(0); - } -} - - - -void st_init_accum_functions(struct dd_function_table *functions) -{ - functions->Accum = st_Accum; -} diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c index fc8587f459..f79092291b 100644 --- a/src/mesa/state_tracker/st_atom.c +++ b/src/mesa/state_tracker/st_atom.c @@ -69,7 +69,7 @@ void st_init_atoms( struct st_context *st ) { GLuint i; - st->atoms = malloc(sizeof(atoms)); + st->atoms = _mesa_malloc(sizeof(atoms)); st->nr_atoms = sizeof(atoms)/sizeof(*atoms); memcpy(st->atoms, atoms, sizeof(atoms)); @@ -92,7 +92,7 @@ void st_init_atoms( struct st_context *st ) void st_destroy_atoms( struct st_context *st ) { if (st->atoms) { - free(st->atoms); + _mesa_free(st->atoms); st->atoms = NULL; } } diff --git a/src/mesa/state_tracker/st_atom_constbuf.c b/src/mesa/state_tracker/st_atom_constbuf.c index d02e51cb9a..2df6fef210 100644 --- a/src/mesa/state_tracker/st_atom_constbuf.c +++ b/src/mesa/state_tracker/st_atom_constbuf.c @@ -85,14 +85,10 @@ void st_upload_constants( struct st_context *st, } /* load Mesa constants into the constant buffer */ - if (cbuf->buffer) { - void *map = pipe_buffer_map(pipe->screen, cbuf->buffer, - PIPE_BUFFER_USAGE_CPU_WRITE); - memcpy(map, params->ParameterValues, paramBytes); - pipe_buffer_unmap(pipe->screen, cbuf->buffer); - } - - cbuf->size = paramBytes; + if (cbuf->buffer) + pipe_buffer_write(pipe->screen, cbuf->buffer, + 0, paramBytes, + params->ParameterValues); st->pipe->set_constant_buffer(st->pipe, id, 0, cbuf); } diff --git a/src/mesa/state_tracker/st_atom_depth.c b/src/mesa/state_tracker/st_atom_depth.c index 0e791ceb20..0aa128f947 100644 --- a/src/mesa/state_tracker/st_atom_depth.c +++ b/src/mesa/state_tracker/st_atom_depth.c @@ -94,36 +94,40 @@ static void update_depth_stencil_alpha(struct st_context *st) { struct pipe_depth_stencil_alpha_state *dsa = &st->state.depth_stencil; + GLcontext *ctx = st->ctx; memset(dsa, 0, sizeof(*dsa)); - dsa->depth.enabled = st->ctx->Depth.Test; - dsa->depth.writemask = st->ctx->Depth.Mask; - dsa->depth.func = st_compare_func_to_pipe(st->ctx->Depth.Func); + if (ctx->Depth.Test && ctx->DrawBuffer->Visual.depthBits > 0) { + dsa->depth.enabled = 1; + dsa->depth.writemask = ctx->Depth.Mask; + dsa->depth.func = st_compare_func_to_pipe(ctx->Depth.Func); + } - if (st->ctx->Query.CurrentOcclusionObject && - st->ctx->Query.CurrentOcclusionObject->Active) + if (ctx->Query.CurrentOcclusionObject && + ctx->Query.CurrentOcclusionObject->Active) dsa->depth.occlusion_count = 1; - if (st->ctx->Stencil.Enabled && st->ctx->Visual.stencilBits > 0) { + if (ctx->Stencil.Enabled && ctx->DrawBuffer->Visual.stencilBits > 0) { dsa->stencil[0].enabled = 1; - dsa->stencil[0].func = st_compare_func_to_pipe(st->ctx->Stencil.Function[0]); - dsa->stencil[0].fail_op = gl_stencil_op_to_pipe(st->ctx->Stencil.FailFunc[0]); - dsa->stencil[0].zfail_op = gl_stencil_op_to_pipe(st->ctx->Stencil.ZFailFunc[0]); - dsa->stencil[0].zpass_op = gl_stencil_op_to_pipe(st->ctx->Stencil.ZPassFunc[0]); - dsa->stencil[0].ref_value = st->ctx->Stencil.Ref[0] & 0xff; - dsa->stencil[0].value_mask = st->ctx->Stencil.ValueMask[0] & 0xff; - dsa->stencil[0].write_mask = st->ctx->Stencil.WriteMask[0] & 0xff; - - if (st->ctx->Stencil._TestTwoSide) { + dsa->stencil[0].func = st_compare_func_to_pipe(ctx->Stencil.Function[0]); + dsa->stencil[0].fail_op = gl_stencil_op_to_pipe(ctx->Stencil.FailFunc[0]); + dsa->stencil[0].zfail_op = gl_stencil_op_to_pipe(ctx->Stencil.ZFailFunc[0]); + dsa->stencil[0].zpass_op = gl_stencil_op_to_pipe(ctx->Stencil.ZPassFunc[0]); + dsa->stencil[0].ref_value = ctx->Stencil.Ref[0] & 0xff; + dsa->stencil[0].valuemask = ctx->Stencil.ValueMask[0] & 0xff; + dsa->stencil[0].writemask = ctx->Stencil.WriteMask[0] & 0xff; + + if (ctx->Stencil._TestTwoSide) { + const GLuint back = ctx->Stencil._BackFace; dsa->stencil[1].enabled = 1; - dsa->stencil[1].func = st_compare_func_to_pipe(st->ctx->Stencil.Function[1]); - dsa->stencil[1].fail_op = gl_stencil_op_to_pipe(st->ctx->Stencil.FailFunc[1]); - dsa->stencil[1].zfail_op = gl_stencil_op_to_pipe(st->ctx->Stencil.ZFailFunc[1]); - dsa->stencil[1].zpass_op = gl_stencil_op_to_pipe(st->ctx->Stencil.ZPassFunc[1]); - dsa->stencil[1].ref_value = st->ctx->Stencil.Ref[1] & 0xff; - dsa->stencil[1].value_mask = st->ctx->Stencil.ValueMask[1] & 0xff; - dsa->stencil[1].write_mask = st->ctx->Stencil.WriteMask[1] & 0xff; + dsa->stencil[1].func = st_compare_func_to_pipe(ctx->Stencil.Function[back]); + dsa->stencil[1].fail_op = gl_stencil_op_to_pipe(ctx->Stencil.FailFunc[back]); + dsa->stencil[1].zfail_op = gl_stencil_op_to_pipe(ctx->Stencil.ZFailFunc[back]); + dsa->stencil[1].zpass_op = gl_stencil_op_to_pipe(ctx->Stencil.ZPassFunc[back]); + dsa->stencil[1].ref_value = ctx->Stencil.Ref[back] & 0xff; + dsa->stencil[1].valuemask = ctx->Stencil.ValueMask[back] & 0xff; + dsa->stencil[1].writemask = ctx->Stencil.WriteMask[back] & 0xff; } else { dsa->stencil[1] = dsa->stencil[0]; @@ -131,10 +135,10 @@ update_depth_stencil_alpha(struct st_context *st) } } - if (st->ctx->Color.AlphaEnabled) { + if (ctx->Color.AlphaEnabled) { dsa->alpha.enabled = 1; - dsa->alpha.func = st_compare_func_to_pipe(st->ctx->Color.AlphaFunc); - dsa->alpha.ref = st->ctx->Color.AlphaRef; + dsa->alpha.func = st_compare_func_to_pipe(ctx->Color.AlphaFunc); + dsa->alpha.ref_value = ctx->Color.AlphaRef; } cso_set_depth_stencil_alpha(st->cso_context, dsa); diff --git a/src/mesa/state_tracker/st_atom_framebuffer.c b/src/mesa/state_tracker/st_atom_framebuffer.c index 2916886610..625efdd66b 100644 --- a/src/mesa/state_tracker/st_atom_framebuffer.c +++ b/src/mesa/state_tracker/st_atom_framebuffer.c @@ -34,6 +34,7 @@ #include "st_context.h" #include "st_atom.h" #include "st_cb_fbo.h" +#include "st_public.h" #include "st_texture.h" #include "pipe/p_context.h" #include "pipe/p_inlines.h" @@ -95,7 +96,7 @@ update_framebuffer_state( struct st_context *st ) struct pipe_framebuffer_state *framebuffer = &st->state.framebuffer; struct gl_framebuffer *fb = st->ctx->DrawBuffer; struct st_renderbuffer *strb; - GLuint i, j; + GLuint i; memset(framebuffer, 0, sizeof(*framebuffer)); @@ -107,21 +108,19 @@ update_framebuffer_state( struct st_context *st ) /* Examine Mesa's ctx->DrawBuffer->_ColorDrawBuffers state * to determine which surfaces to draw to */ - framebuffer->num_cbufs = 0; - for (j = 0; j < MAX_DRAW_BUFFERS; j++) { - for (i = 0; i < fb->_NumColorDrawBuffers[j]; i++) { - strb = st_renderbuffer(fb->_ColorDrawBuffers[j][i]); - - /*printf("--------- framebuffer surface rtt %p\n", strb->rtt);*/ - if (strb->rtt) { - /* rendering to a GL texture, may have to update surface */ - update_renderbuffer_surface(st, strb); - } + framebuffer->nr_cbufs = 0; + for (i = 0; i < fb->_NumColorDrawBuffers; i++) { + strb = st_renderbuffer(fb->_ColorDrawBuffers[i]); - if (strb->surface) { - framebuffer->cbufs[framebuffer->num_cbufs] = strb->surface; - framebuffer->num_cbufs++; - } + /*printf("--------- framebuffer surface rtt %p\n", strb->rtt);*/ + if (strb->rtt) { + /* rendering to a GL texture, may have to update surface */ + update_renderbuffer_surface(st, strb); + } + + if (strb->surface) { + framebuffer->cbufs[framebuffer->nr_cbufs] = strb->surface; + framebuffer->nr_cbufs++; } } @@ -146,9 +145,19 @@ update_framebuffer_state( struct st_context *st ) cso_set_framebuffer(st->cso_context, framebuffer); - if (fb->_ColorDrawBufferMask[0] & BUFFER_BIT_FRONT_LEFT) { + if (fb->_ColorDrawBufferIndexes[0] == BUFFER_FRONT_LEFT) { if (st->frontbuffer_status == FRONT_STATUS_COPY_OF_BACK) { - /* XXX copy back buf to front? */ + /* copy back color buffer to front color buffer */ + struct st_framebuffer *stfb = (struct st_framebuffer *) fb; + struct pipe_surface *surf_front, *surf_back; + (void) st_get_framebuffer_surface(stfb, ST_SURFACE_FRONT_LEFT, &surf_front); + (void) st_get_framebuffer_surface(stfb, ST_SURFACE_BACK_LEFT, &surf_back); + + st->pipe->surface_copy(st->pipe, + FALSE, + surf_front, 0, 0, /* dest */ + surf_back, 0, 0, /* src */ + fb->Width, fb->Height); } /* we're assuming we'll really draw to the front buffer */ st->frontbuffer_status = FRONT_STATUS_DIRTY; diff --git a/src/mesa/state_tracker/st_atom_pixeltransfer.c b/src/mesa/state_tracker/st_atom_pixeltransfer.c index a357b71677..05b69c9d00 100644 --- a/src/mesa/state_tracker/st_atom_pixeltransfer.c +++ b/src/mesa/state_tracker/st_atom_pixeltransfer.c @@ -140,7 +140,7 @@ load_color_map_texture(GLcontext *ctx, struct pipe_texture *pt) { struct pipe_context *pipe = ctx->st->pipe; struct pipe_screen *screen = pipe->screen; - struct pipe_surface *surface; + struct pipe_transfer *transfer; const GLuint rSize = ctx->PixelMaps.RtoR.Size; const GLuint gSize = ctx->PixelMaps.GtoG.Size; const GLuint bSize = ctx->PixelMaps.BtoB.Size; @@ -149,10 +149,9 @@ load_color_map_texture(GLcontext *ctx, struct pipe_texture *pt) uint *dest; uint i, j; - surface = screen->get_tex_surface(screen, pt, 0, 0, 0, - PIPE_BUFFER_USAGE_CPU_WRITE); - dest = (uint *) screen->surface_map(screen, surface, - PIPE_BUFFER_USAGE_CPU_WRITE); + transfer = screen->get_tex_transfer(screen, pt, 0, 0, 0, PIPE_TRANSFER_WRITE, + 0, 0, texSize, texSize); + dest = (uint *) screen->transfer_map(screen, transfer); /* Pack four 1D maps into a 2D texture: * R map is placed horizontally, indexed by S, in channel 0 @@ -171,8 +170,8 @@ load_color_map_texture(GLcontext *ctx, struct pipe_texture *pt) } } - screen->surface_unmap(screen, surface); - pipe_surface_reference(&surface, NULL); + screen->transfer_unmap(screen, transfer); + screen->tex_transfer_release(screen, &transfer); } @@ -213,7 +212,7 @@ get_pixel_transfer_program(GLcontext *ctx, const struct state_key *key) inst[ic].TexSrcTarget = TEXTURE_2D_INDEX; ic++; fp->Base.InputsRead = (1 << FRAG_ATTRIB_TEX0); - fp->Base.OutputsWritten = (1 << FRAG_RESULT_COLR); + fp->Base.OutputsWritten = (1 << FRAG_RESULT_COLOR); fp->Base.SamplersUsed = 0x1; /* sampler 0 (bit 0) is used */ if (key->scaleAndBias) { @@ -401,7 +400,7 @@ get_pixel_transfer_program(GLcontext *ctx, const struct state_key *key) { struct prog_instruction *last = &inst[ic - 1]; last->DstReg.File = PROGRAM_OUTPUT; - last->DstReg.Index = FRAG_RESULT_COLR; + last->DstReg.Index = FRAG_RESULT_COLOR; } /* END; */ diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c index cef61fb55c..d7b904354f 100644 --- a/src/mesa/state_tracker/st_atom_sampler.c +++ b/src/mesa/state_tracker/st_atom_sampler.c @@ -121,24 +121,30 @@ gl_filter_to_img_filter(GLenum filter) static void update_samplers(struct st_context *st) { - const struct st_fragment_program *fs = st->fp; + struct gl_vertex_program *vprog = st->ctx->VertexProgram._Current; + struct gl_fragment_program *fprog = st->ctx->FragmentProgram._Current; + const GLbitfield samplersUsed = (vprog->Base.SamplersUsed | + fprog->Base.SamplersUsed); GLuint su; st->state.num_samplers = 0; - /*printf("%s samplers used = 0x%x\n", __FUNCTION__, fs->Base.Base.SamplersUsed);*/ - /* loop over sampler units (aka tex image units) */ for (su = 0; su < st->ctx->Const.MaxTextureImageUnits; su++) { struct pipe_sampler_state *sampler = st->state.samplers + su; memset(sampler, 0, sizeof(*sampler)); - if (fs->Base.Base.SamplersUsed & (1 << su)) { - GLuint texUnit = fs->Base.Base.SamplerUnits[su]; - const struct gl_texture_object *texobj - = st->ctx->Texture.Unit[texUnit]._Current; + if (samplersUsed & (1 << su)) { + struct gl_texture_object *texobj; + GLuint texUnit; + + if (fprog->Base.SamplersUsed & (1 << su)) + texUnit = fprog->Base.SamplerUnits[su]; + else + texUnit = vprog->Base.SamplerUnits[su]; + texobj = st->ctx->Texture.Unit[texUnit]._Current; if (!texobj) { texobj = st_get_default_texture(st); } diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c index cbd414e2d3..486582fce8 100644 --- a/src/mesa/state_tracker/st_atom_shader.c +++ b/src/mesa/state_tracker/st_atom_shader.c @@ -165,7 +165,7 @@ find_translated_vp(struct st_context *st, /* No? Allocate translated vp object now */ if (!xvp) { - xvp = CALLOC_STRUCT(translated_vertex_program); + xvp = ST_CALLOC_STRUCT(translated_vertex_program); xvp->frag_inputs = fragInputsRead; xvp->master = stvp; @@ -298,7 +298,7 @@ st_free_translated_vertex_programs(struct st_context *st, while (xvp) { next = xvp->next; - free(xvp); + _mesa_free(xvp); xvp = next; } } @@ -313,7 +313,7 @@ get_passthrough_fs(struct st_context *st) st->passthrough_fs = util_make_fragment_passthrough_shader(st->pipe, &shader); #if 0 /* We actually need to keep the tokens around at this time */ - free((void *) shader.tokens); + util_free_shader(&shader); #endif } diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c index fb03766ff5..21f7321f97 100644 --- a/src/mesa/state_tracker/st_atom_texture.c +++ b/src/mesa/state_tracker/st_atom_texture.c @@ -44,22 +44,30 @@ static void update_textures(struct st_context *st) { + struct gl_vertex_program *vprog = st->ctx->VertexProgram._Current; struct gl_fragment_program *fprog = st->ctx->FragmentProgram._Current; + const GLbitfield samplersUsed = (vprog->Base.SamplersUsed | + fprog->Base.SamplersUsed); GLuint su; st->state.num_textures = 0; - /*printf("%s samplers used = 0x%x\n", __FUNCTION__, fprog->Base.SamplersUsed);*/ - - for (su = 0; su < st->ctx->Const.MaxTextureCoordUnits; su++) { + /* loop over sampler units (aka tex image units) */ + for (su = 0; su < st->ctx->Const.MaxTextureImageUnits; su++) { struct pipe_texture *pt = NULL; - if (fprog->Base.SamplersUsed & (1 << su)) { - const GLuint texUnit = fprog->Base.SamplerUnits[su]; - struct gl_texture_object *texObj - = st->ctx->Texture.Unit[texUnit]._Current; + if (samplersUsed & (1 << su)) { + struct gl_texture_object *texObj; struct st_texture_object *stObj; GLboolean flush, retval; + GLuint texUnit; + + if (fprog->Base.SamplersUsed & (1 << su)) + texUnit = fprog->Base.SamplerUnits[su]; + else + texUnit = vprog->Base.SamplerUnits[su]; + + texObj = st->ctx->Texture.Unit[texUnit]._Current; if (!texObj) { texObj = st_get_default_texture(st); diff --git a/src/mesa/state_tracker/st_cb_accum.c b/src/mesa/state_tracker/st_cb_accum.c index a4e72b48ed..15cc4cd95d 100644 --- a/src/mesa/state_tracker/st_cb_accum.c +++ b/src/mesa/state_tracker/st_cb_accum.c @@ -63,21 +63,21 @@ * See also: st_renderbuffer_alloc_storage() */ static void -acc_get_tile_rgba(struct pipe_context *pipe, struct pipe_surface *acc_ps, +acc_get_tile_rgba(struct pipe_context *pipe, struct pipe_transfer *acc_pt, uint x, uint y, uint w, uint h, float *p) { - const enum pipe_format f = acc_ps->format; - const struct pipe_format_block b = acc_ps->block; + const enum pipe_format f = acc_pt->format; + const struct pipe_format_block b = acc_pt->block; - acc_ps->format = DEFAULT_ACCUM_PIPE_FORMAT; - acc_ps->block.size = 8; - acc_ps->block.width = 1; - acc_ps->block.height = 1; + acc_pt->format = DEFAULT_ACCUM_PIPE_FORMAT; + acc_pt->block.size = 8; + acc_pt->block.width = 1; + acc_pt->block.height = 1; - pipe_get_tile_rgba(acc_ps, x, y, w, h, p); + pipe_get_tile_rgba(acc_pt, x, y, w, h, p); - acc_ps->format = f; - acc_ps->block = b; + acc_pt->format = f; + acc_pt->block = b; } @@ -87,21 +87,21 @@ acc_get_tile_rgba(struct pipe_context *pipe, struct pipe_surface *acc_ps, * See also: st_renderbuffer_alloc_storage() */ static void -acc_put_tile_rgba(struct pipe_context *pipe, struct pipe_surface *acc_ps, +acc_put_tile_rgba(struct pipe_context *pipe, struct pipe_transfer *acc_pt, uint x, uint y, uint w, uint h, const float *p) { - enum pipe_format f = acc_ps->format; - const struct pipe_format_block b = acc_ps->block; + enum pipe_format f = acc_pt->format; + const struct pipe_format_block b = acc_pt->block; - acc_ps->format = DEFAULT_ACCUM_PIPE_FORMAT; - acc_ps->block.size = 8; - acc_ps->block.width = 1; - acc_ps->block.height = 1; + acc_pt->format = DEFAULT_ACCUM_PIPE_FORMAT; + acc_pt->block.size = 8; + acc_pt->block.width = 1; + acc_pt->block.height = 1; - pipe_put_tile_rgba(acc_ps, x, y, w, h, p); + pipe_put_tile_rgba(acc_pt, x, y, w, h, p); - acc_ps->format = f; - acc_ps->block = b; + acc_pt->format = f; + acc_pt->block = b; } @@ -110,7 +110,7 @@ void st_clear_accum_buffer(GLcontext *ctx, struct gl_renderbuffer *rb) { struct st_renderbuffer *acc_strb = st_renderbuffer(rb); - struct pipe_surface *acc_ps; + struct pipe_transfer *acc_pt; struct pipe_screen *screen = ctx->st->pipe->screen; const GLint xpos = ctx->DrawBuffer->_Xmin; const GLint ypos = ctx->DrawBuffer->_Ymin; @@ -118,12 +118,12 @@ st_clear_accum_buffer(GLcontext *ctx, struct gl_renderbuffer *rb) const GLint height = ctx->DrawBuffer->_Ymax - ypos; GLubyte *map; - acc_ps = screen->get_tex_surface(screen, acc_strb->texture, 0, 0, 0, - PIPE_BUFFER_USAGE_CPU_WRITE); - map = screen->surface_map(screen, acc_ps, - PIPE_BUFFER_USAGE_CPU_WRITE); + acc_pt = screen->get_tex_transfer(screen, acc_strb->texture, 0, 0, 0, + PIPE_TRANSFER_WRITE, xpos, ypos, + width, height); + map = screen->transfer_map(screen, acc_pt); - /* note acc_strb->format might not equal acc_ps->format */ + /* note acc_strb->format might not equal acc_pt->format */ switch (acc_strb->format) { case PIPE_FORMAT_R16G16B16A16_SNORM: { @@ -133,7 +133,7 @@ st_clear_accum_buffer(GLcontext *ctx, struct gl_renderbuffer *rb) GLshort a = FLOAT_TO_SHORT(ctx->Accum.ClearColor[3]); int i, j; for (i = 0; i < height; i++) { - GLshort *dst = (GLshort *) (map + (ypos + i) * acc_ps->stride + xpos * 8); + GLshort *dst = (GLshort *) (map + i * acc_pt->stride + xpos * 8); for (j = 0; j < width; j++) { dst[0] = r; dst[1] = g; @@ -148,8 +148,8 @@ st_clear_accum_buffer(GLcontext *ctx, struct gl_renderbuffer *rb) _mesa_problem(ctx, "unexpected format in st_clear_accum_buffer()"); } - screen->surface_unmap(screen, acc_ps); - pipe_surface_reference(&acc_ps, NULL); + screen->transfer_unmap(screen, acc_pt); + screen->tex_transfer_release(screen, &acc_pt); } @@ -160,19 +160,21 @@ accum_mad(GLcontext *ctx, GLfloat scale, GLfloat bias, struct st_renderbuffer *acc_strb) { struct pipe_screen *screen = ctx->st->pipe->screen; - struct pipe_surface *acc_ps = acc_strb->surface; + struct pipe_transfer *acc_pt; GLubyte *map; - map = screen->surface_map(screen, acc_ps, - PIPE_BUFFER_USAGE_CPU_WRITE); + acc_pt = screen->get_tex_transfer(screen, acc_strb->texture, 0, 0, 0, + PIPE_TRANSFER_READ_WRITE, xpos, ypos, + width, height); + map = screen->transfer_map(screen, acc_pt); - /* note acc_strb->format might not equal acc_ps->format */ + /* note acc_strb->format might not equal acc_pt->format */ switch (acc_strb->format) { case PIPE_FORMAT_R16G16B16A16_SNORM: { int i, j; for (i = 0; i < height; i++) { - GLshort *acc = (GLshort *) (map + (ypos + i) * acc_ps->stride + xpos * 8); + GLshort *acc = (GLshort *) (map + (ypos + i) * acc_pt->stride + xpos * 8); for (j = 0; j < width * 4; j++) { float val = SHORT_TO_FLOAT(acc[j]) * scale + bias; acc[j] = FLOAT_TO_SHORT(val); @@ -184,7 +186,8 @@ accum_mad(GLcontext *ctx, GLfloat scale, GLfloat bias, _mesa_problem(NULL, "unexpected format in st_clear_accum_buffer()"); } - screen->surface_unmap(screen, acc_ps); + screen->transfer_unmap(screen, acc_pt); + screen->tex_transfer_release(screen, &acc_pt); } @@ -195,33 +198,39 @@ accum_accum(struct pipe_context *pipe, GLfloat value, struct st_renderbuffer *color_strb) { struct pipe_screen *screen = pipe->screen; - struct pipe_surface *acc_surf, *color_surf; + struct pipe_transfer *acc_trans, *color_trans; GLfloat *colorBuf, *accBuf; GLint i; - acc_surf = screen->get_tex_surface(screen, acc_strb->texture, 0, 0, 0, - (PIPE_BUFFER_USAGE_CPU_WRITE | - PIPE_BUFFER_USAGE_CPU_READ)); + acc_trans = screen->get_tex_transfer(screen, acc_strb->texture, 0, 0, 0, + PIPE_TRANSFER_READ, xpos, ypos, + width, height); - color_surf = screen->get_tex_surface(screen, color_strb->texture, 0, 0, 0, - PIPE_BUFFER_USAGE_CPU_READ); + color_trans = screen->get_tex_transfer(screen, color_strb->texture, 0, 0, 0, + PIPE_TRANSFER_READ, xpos, ypos, + width, height); - colorBuf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat)); - accBuf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat)); + colorBuf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat)); + accBuf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat)); - pipe_get_tile_rgba(color_surf, xpos, ypos, width, height, colorBuf); - acc_get_tile_rgba(pipe, acc_surf, xpos, ypos, width, height, accBuf); + pipe_get_tile_rgba(color_trans, 0, 0, width, height, colorBuf); + acc_get_tile_rgba(pipe, acc_trans, 0, 0, width, height, accBuf); for (i = 0; i < 4 * width * height; i++) { accBuf[i] = accBuf[i] + colorBuf[i] * value; } - acc_put_tile_rgba(pipe, acc_surf, xpos, ypos, width, height, accBuf); + screen->tex_transfer_release(screen, &acc_trans); + acc_trans = screen->get_tex_transfer(screen, acc_strb->texture, 0, 0, 0, + PIPE_TRANSFER_WRITE, xpos, ypos, + width, height); - free(colorBuf); - free(accBuf); - pipe_surface_reference(&acc_surf, NULL); - pipe_surface_reference(&color_surf, NULL); + acc_put_tile_rgba(pipe, acc_trans, 0, 0, width, height, accBuf); + + _mesa_free(colorBuf); + _mesa_free(accBuf); + screen->tex_transfer_release(screen, &acc_trans); + screen->tex_transfer_release(screen, &color_trans); } @@ -232,29 +241,31 @@ accum_load(struct pipe_context *pipe, GLfloat value, struct st_renderbuffer *color_strb) { struct pipe_screen *screen = pipe->screen; - struct pipe_surface *acc_surf, *color_surf; + struct pipe_transfer *acc_trans, *color_trans; GLfloat *buf; GLint i; - acc_surf = screen->get_tex_surface(screen, acc_strb->texture, 0, 0, 0, - PIPE_BUFFER_USAGE_CPU_WRITE); + acc_trans = screen->get_tex_transfer(screen, acc_strb->texture, 0, 0, 0, + PIPE_TRANSFER_WRITE, xpos, ypos, + width, height); - color_surf = screen->get_tex_surface(screen, color_strb->texture, 0, 0, 0, - PIPE_BUFFER_USAGE_CPU_READ); + color_trans = screen->get_tex_transfer(screen, color_strb->texture, 0, 0, 0, + PIPE_TRANSFER_READ, xpos, ypos, + width, height); - buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat)); + buf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat)); - pipe_get_tile_rgba(color_surf, xpos, ypos, width, height, buf); + pipe_get_tile_rgba(color_trans, 0, 0, width, height, buf); for (i = 0; i < 4 * width * height; i++) { buf[i] = buf[i] * value; } - acc_put_tile_rgba(pipe, acc_surf, xpos, ypos, width, height, buf); + acc_put_tile_rgba(pipe, acc_trans, 0, 0, width, height, buf); - free(buf); - pipe_surface_reference(&acc_surf, NULL); - pipe_surface_reference(&color_surf, NULL); + _mesa_free(buf); + screen->tex_transfer_release(screen, &acc_trans); + screen->tex_transfer_release(screen, &color_trans); } @@ -267,24 +278,25 @@ accum_return(GLcontext *ctx, GLfloat value, struct pipe_context *pipe = ctx->st->pipe; struct pipe_screen *screen = pipe->screen; const GLubyte *colormask = ctx->Color.ColorMask; - struct pipe_surface *acc_surf, *color_surf; + struct pipe_transfer *acc_trans, *color_trans; GLfloat *abuf, *cbuf = NULL; GLint i, ch; - abuf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat)); + abuf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat)); - acc_surf = screen->get_tex_surface(screen, acc_strb->texture, 0, 0, 0, - PIPE_BUFFER_USAGE_CPU_READ); + acc_trans = screen->get_tex_transfer(screen, acc_strb->texture, 0, 0, 0, + PIPE_TRANSFER_READ, xpos, ypos, + width, height); - color_surf = screen->get_tex_surface(screen, color_strb->texture, 0, 0, 0, - (PIPE_BUFFER_USAGE_CPU_READ | - PIPE_BUFFER_USAGE_CPU_WRITE)); + color_trans = screen->get_tex_transfer(screen, color_strb->texture, 0, 0, 0, + PIPE_TRANSFER_READ_WRITE, xpos, ypos, + width, height); - acc_get_tile_rgba(pipe, acc_surf, xpos, ypos, width, height, abuf); + acc_get_tile_rgba(pipe, acc_trans, 0, 0, width, height, abuf); if (!colormask[0] || !colormask[1] || !colormask[2] || !colormask[3]) { - cbuf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat)); - pipe_get_tile_rgba(color_surf, xpos, ypos, width, height, cbuf); + cbuf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat)); + pipe_get_tile_rgba(color_trans, 0, 0, width, height, cbuf); } for (i = 0; i < width * height; i++) { @@ -299,13 +311,13 @@ accum_return(GLcontext *ctx, GLfloat value, } } - pipe_put_tile_rgba(color_surf, xpos, ypos, width, height, abuf); + pipe_put_tile_rgba(color_trans, 0, 0, width, height, abuf); - free(abuf); + _mesa_free(abuf); if (cbuf) - free(cbuf); - pipe_surface_reference(&acc_surf, NULL); - pipe_surface_reference(&color_surf, NULL); + _mesa_free(cbuf); + screen->tex_transfer_release(screen, &acc_trans); + screen->tex_transfer_release(screen, &color_trans); } diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index bc05ca6a2f..f55a5e713f 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -93,7 +93,7 @@ struct bitmap_cache GLfloat color[4]; struct pipe_texture *texture; - struct pipe_surface *surf; + struct pipe_transfer *trans; GLboolean empty; @@ -142,6 +142,10 @@ make_bitmap_fragment_program(GLcontext *ctx, GLuint samplerIndex) /* KIL if -tmp0 < 0 # texel=0 -> keep / texel=0 -> discard */ p->Instructions[ic].Opcode = OPCODE_KIL; p->Instructions[ic].SrcReg[0].File = PROGRAM_TEMPORARY; + + if (ctx->st->bitmap.tex_format == PIPE_FORMAT_L8_UNORM) + p->Instructions[ic].SrcReg[0].Swizzle = SWIZZLE_XXXX; + p->Instructions[ic].SrcReg[0].Index = 0; p->Instructions[ic].SrcReg[0].NegateBase = NEGATE_XYZW; ic++; @@ -157,7 +161,11 @@ make_bitmap_fragment_program(GLcontext *ctx, GLuint samplerIndex) stfp = (struct st_fragment_program *) p; stfp->Base.UsesKill = GL_TRUE; - st_translate_fragment_program(ctx->st, stfp, NULL); + + /* No need to send this incomplete program down to hardware: + * + * st_translate_fragment_program(ctx->st, stfp, NULL); + */ return stfp; } @@ -308,7 +316,7 @@ make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height, { struct pipe_context *pipe = ctx->st->pipe; struct pipe_screen *screen = pipe->screen; - struct pipe_surface *surface; + struct pipe_transfer *transfer; ubyte *dest; struct pipe_texture *pt; @@ -329,22 +337,21 @@ make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height, return NULL; } - surface = screen->get_tex_surface(screen, pt, 0, 0, 0, - PIPE_BUFFER_USAGE_CPU_WRITE); + transfer = screen->get_tex_transfer(screen, pt, 0, 0, 0, PIPE_TRANSFER_WRITE, + 0, 0, width, height); - /* map texture surface */ - dest = screen->surface_map(screen, surface, PIPE_BUFFER_USAGE_CPU_WRITE); + dest = screen->transfer_map(screen, transfer); - /* Put image into texture surface */ - memset(dest, 0xff, height * surface->stride); + /* Put image into texture transfer */ + memset(dest, 0xff, height * transfer->stride); unpack_bitmap(ctx->st, 0, 0, width, height, unpack, bitmap, - dest, surface->stride); + dest, transfer->stride); _mesa_unmap_bitmap_pbo(ctx, unpack); - /* Release surface */ - screen->surface_unmap(screen, surface); - pipe_surface_reference(&surface, NULL); + /* Release transfer */ + screen->transfer_unmap(screen, transfer); + screen->tex_transfer_release(screen, &transfer); return pt; } @@ -418,17 +425,11 @@ setup_bitmap_vertex_data(struct st_context *st, } /* put vertex data into vbuf */ - { - char *buf = pipe_buffer_map(pipe->screen, - st->bitmap.vbuf, - PIPE_BUFFER_USAGE_CPU_WRITE); - - memcpy(buf + st->bitmap.vbuf_slot * sizeof st->bitmap.vertices, - st->bitmap.vertices, - sizeof st->bitmap.vertices); - - pipe_buffer_unmap(pipe->screen, st->bitmap.vbuf); - } + pipe_buffer_write(pipe->screen, + st->bitmap.vbuf, + st->bitmap.vbuf_slot * sizeof st->bitmap.vertices, + sizeof st->bitmap.vertices, + st->bitmap.vertices); return st->bitmap.vbuf_slot++ * sizeof st->bitmap.vertices; } @@ -569,8 +570,8 @@ reset_cache(struct st_context *st) cache->ymin = 1000000; cache->ymax = -1000000; - if (cache->surf) - screen->tex_surface_release(screen, &cache->surf); + if (cache->trans) + screen->tex_transfer_release(screen, &cache->trans); assert(!cache->texture); @@ -581,16 +582,17 @@ reset_cache(struct st_context *st) 1, 0, PIPE_TEXTURE_USAGE_SAMPLER); - /* Map the texture surface. + /* Map the texture transfer. * Subsequent glBitmap calls will write into the texture image. */ - cache->surf = screen->get_tex_surface(screen, cache->texture, 0, 0, 0, - PIPE_BUFFER_USAGE_CPU_WRITE); - cache->buffer = screen->surface_map(screen, cache->surf, - PIPE_BUFFER_USAGE_CPU_WRITE); + cache->trans = screen->get_tex_transfer(screen, cache->texture, 0, 0, 0, + PIPE_TRANSFER_WRITE, 0, 0, + BITMAP_CACHE_WIDTH, + BITMAP_CACHE_HEIGHT); + cache->buffer = screen->transfer_map(screen, cache->trans); /* init image to all 0xff */ - memset(cache->buffer, 0xff, BITMAP_CACHE_WIDTH * BITMAP_CACHE_HEIGHT); + memset(cache->buffer, 0xff, cache->trans->stride * BITMAP_CACHE_HEIGHT); } @@ -615,13 +617,13 @@ st_flush_bitmap_cache(struct st_context *st) cache->xpos, cache->ypos); */ - /* The texture surface has been mapped until now. - * So unmap and release the texture surface before drawing. + /* The texture transfer has been mapped until now. + * So unmap and release the texture transfer before drawing. */ - screen->surface_unmap(screen, cache->surf); + screen->transfer_unmap(screen, cache->trans); cache->buffer = NULL; - screen->tex_surface_release(screen, &cache->surf); + screen->tex_transfer_release(screen, &cache->trans); draw_bitmap_quad(st->ctx, cache->xpos, @@ -792,13 +794,17 @@ st_init_bitmap(struct st_context *st) PIPE_TEXTURE_USAGE_SAMPLER, 0)) { st->bitmap.tex_format = PIPE_FORMAT_I8_UNORM; } + else if (screen->is_format_supported(screen, PIPE_FORMAT_L8_UNORM, PIPE_TEXTURE_2D, + PIPE_TEXTURE_USAGE_SAMPLER, 0)) { + st->bitmap.tex_format = PIPE_FORMAT_L8_UNORM; + } else { /* XXX support more formats */ assert(0); } /* alloc bitmap cache object */ - st->bitmap.cache = CALLOC_STRUCT(bitmap_cache); + st->bitmap.cache = ST_CALLOC_STRUCT(bitmap_cache); reset_cache(st); } @@ -812,22 +818,23 @@ st_destroy_bitmap(struct st_context *st) struct pipe_screen *screen = pipe->screen; struct bitmap_cache *cache = st->bitmap.cache; - screen->surface_unmap(screen, cache->surf); - screen->tex_surface_release(screen, &cache->surf); + screen->transfer_unmap(screen, cache->trans); + screen->tex_transfer_release(screen, &cache->trans); if (st->bitmap.vs) { cso_delete_vertex_shader(st->cso_context, st->bitmap.vs); st->bitmap.vs = NULL; } + util_free_shader(&st->bitmap.vert_shader); if (st->bitmap.vbuf) { - pipe_buffer_destroy(pipe->screen, st->bitmap.vbuf); + pipe_buffer_reference(pipe->screen, &st->bitmap.vbuf, NULL); st->bitmap.vbuf = NULL; } if (st->bitmap.cache) { pipe_texture_release(&st->bitmap.cache->texture); - FREE(st->bitmap.cache); + _mesa_free(st->bitmap.cache); st->bitmap.cache = NULL; } } diff --git a/src/mesa/state_tracker/st_cb_blit.c b/src/mesa/state_tracker/st_cb_blit.c index 327bafeb98..2852623472 100644 --- a/src/mesa/state_tracker/st_cb_blit.c +++ b/src/mesa/state_tracker/st_cb_blit.c @@ -79,7 +79,7 @@ st_BlitFramebuffer(GLcontext *ctx, struct st_renderbuffer *srcRb = st_renderbuffer(ctx->ReadBuffer->_ColorReadBuffer); struct st_renderbuffer *dstRb = - st_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0][0]); + st_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0]); struct pipe_surface *srcSurf = srcRb->surface; struct pipe_surface *dstSurf = dstRb->surface; diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c index b79b934111..28e387c399 100644 --- a/src/mesa/state_tracker/st_cb_bufferobjects.c +++ b/src/mesa/state_tracker/st_cb_bufferobjects.c @@ -55,7 +55,7 @@ static struct gl_buffer_object * st_bufferobj_alloc(GLcontext *ctx, GLuint name, GLenum target) { - struct st_buffer_object *st_obj = CALLOC_STRUCT(st_buffer_object); + struct st_buffer_object *st_obj = ST_CALLOC_STRUCT(st_buffer_object); if (!st_obj) return NULL; @@ -80,7 +80,7 @@ st_bufferobj_free(GLcontext *ctx, struct gl_buffer_object *obj) if (st_obj->buffer) pipe_buffer_reference(pipe->screen, &st_obj->buffer, NULL); - free(st_obj); + _mesa_free(st_obj); } @@ -100,14 +100,11 @@ st_bufferobj_subdata(GLcontext *ctx, { struct pipe_context *pipe = st_context(ctx)->pipe; struct st_buffer_object *st_obj = st_buffer_object(obj); - char *map; if (offset >= st_obj->size || size > (st_obj->size - offset)) return; - map = pipe_buffer_map(pipe->screen, st_obj->buffer, PIPE_BUFFER_USAGE_CPU_WRITE); - memcpy(map + offset, data, size); - pipe_buffer_unmap(pipe->screen, st_obj->buffer); + pipe_buffer_write(pipe->screen, st_obj->buffer, offset, size, data); } @@ -123,14 +120,11 @@ st_bufferobj_get_subdata(GLcontext *ctx, { struct pipe_context *pipe = st_context(ctx)->pipe; struct st_buffer_object *st_obj = st_buffer_object(obj); - char *map; if (offset >= st_obj->size || size > (st_obj->size - offset)) return; - map = pipe_buffer_map(pipe->screen, st_obj->buffer, PIPE_BUFFER_USAGE_CPU_READ); - memcpy(data, map + offset, size); - pipe_buffer_unmap(pipe->screen, st_obj->buffer); + pipe_buffer_read(pipe->screen, st_obj->buffer, offset, size, data); } diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c index b6cea16163..c6fc7cec27 100644 --- a/src/mesa/state_tracker/st_cb_clear.c +++ b/src/mesa/state_tracker/st_cb_clear.c @@ -98,12 +98,12 @@ st_destroy_clear(struct st_context *st) struct pipe_context *pipe = st->pipe; if (st->clear.vert_shader.tokens) { - FREE((void *) st->clear.vert_shader.tokens); + util_free_shader(&st->clear.vert_shader); st->clear.vert_shader.tokens = NULL; } if (st->clear.frag_shader.tokens) { - FREE((void *) st->clear.frag_shader.tokens); + util_free_shader(&st->clear.frag_shader); st->clear.frag_shader.tokens = NULL; } @@ -116,7 +116,7 @@ st_destroy_clear(struct st_context *st) st->clear.vs = NULL; } if (st->clear.vbuf) { - pipe_buffer_destroy(pipe->screen, st->clear.vbuf); + pipe_buffer_reference(pipe->screen, &st->clear.vbuf, NULL); st->clear.vbuf = NULL; } } @@ -150,7 +150,6 @@ draw_quad(GLcontext *ctx, struct pipe_context *pipe = st->pipe; const GLuint max_slots = 1024 / sizeof(st->clear.vertices); GLuint i; - void *buf; if (st->clear.vbuf_slot >= max_slots) { pipe_buffer_reference(pipe->screen, &st->clear.vbuf, NULL); @@ -186,13 +185,10 @@ draw_quad(GLcontext *ctx, } /* put vertex data into vbuf */ - buf = pipe_buffer_map(pipe->screen, st->clear.vbuf, PIPE_BUFFER_USAGE_CPU_WRITE); - - memcpy((char *)buf + st->clear.vbuf_slot * sizeof(st->clear.vertices), - st->clear.vertices, - sizeof(st->clear.vertices)); - - pipe_buffer_unmap(pipe->screen, st->clear.vbuf); + pipe_buffer_write(pipe->screen, st->clear.vbuf, + st->clear.vbuf_slot * sizeof(st->clear.vertices), + sizeof(st->clear.vertices), + st->clear.vertices); /* draw */ util_draw_vertex_buffer(pipe, @@ -287,8 +283,8 @@ clear_with_quad(GLcontext *ctx, depth_stencil.stencil[0].zpass_op = PIPE_STENCIL_OP_REPLACE; depth_stencil.stencil[0].zfail_op = PIPE_STENCIL_OP_REPLACE; depth_stencil.stencil[0].ref_value = ctx->Stencil.Clear; - depth_stencil.stencil[0].value_mask = 0xff; - depth_stencil.stencil[0].write_mask = ctx->Stencil.WriteMask[0] & 0xff; + depth_stencil.stencil[0].valuemask = 0xff; + depth_stencil.stencil[0].writemask = ctx->Stencil.WriteMask[0] & 0xff; } cso_set_depth_stencil_alpha(st->cso_context, &depth_stencil); diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 32bf21411d..cc7a9e7890 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -75,7 +75,7 @@ is_passthrough_program(const struct gl_fragment_program *prog) if (inst[0].Opcode == OPCODE_MOV && inst[1].Opcode == OPCODE_END && inst[0].DstReg.File == PROGRAM_OUTPUT && - inst[0].DstReg.Index == FRAG_RESULT_COLR && + inst[0].DstReg.Index == FRAG_RESULT_COLOR && inst[0].DstReg.WriteMask == WRITEMASK_XYZW && inst[0].SrcReg[0].File == PROGRAM_INPUT && inst[0].SrcReg[0].Index == FRAG_ATTRIB_COL0 && @@ -158,7 +158,7 @@ combined_drawpix_fragment_program(GLcontext *ctx) /** * Create fragment shader that does a TEX() instruction to get a Z - * value, then writes to FRAG_RESULT_DEPR. + * value, then writes to FRAG_RESULT_DEPTH. * Pass fragment color through as-is. */ static struct st_fragment_program * @@ -191,7 +191,7 @@ make_fragment_shader_z(struct st_context *st) /* TEX result.depth, fragment.texcoord[0], texture[0], 2D; */ p->Instructions[ic].Opcode = OPCODE_TEX; p->Instructions[ic].DstReg.File = PROGRAM_OUTPUT; - p->Instructions[ic].DstReg.Index = FRAG_RESULT_DEPR; + p->Instructions[ic].DstReg.Index = FRAG_RESULT_DEPTH; p->Instructions[ic].DstReg.WriteMask = WRITEMASK_Z; p->Instructions[ic].SrcReg[0].File = PROGRAM_INPUT; p->Instructions[ic].SrcReg[0].Index = FRAG_ATTRIB_TEX0; @@ -202,7 +202,7 @@ make_fragment_shader_z(struct st_context *st) /* MOV result.color, fragment.color */ p->Instructions[ic].Opcode = OPCODE_MOV; p->Instructions[ic].DstReg.File = PROGRAM_OUTPUT; - p->Instructions[ic].DstReg.Index = FRAG_RESULT_COLR; + p->Instructions[ic].DstReg.Index = FRAG_RESULT_COLOR; p->Instructions[ic].SrcReg[0].File = PROGRAM_INPUT; p->Instructions[ic].SrcReg[0].Index = FRAG_ATTRIB_COL0; ic++; @@ -213,7 +213,7 @@ make_fragment_shader_z(struct st_context *st) assert(ic == p->NumInstructions); p->InputsRead = FRAG_BIT_TEX0 | FRAG_BIT_COL0; - p->OutputsWritten = (1 << FRAG_RESULT_COLR) | (1 << FRAG_RESULT_DEPR); + p->OutputsWritten = (1 << FRAG_RESULT_COLOR) | (1 << FRAG_RESULT_DEPTH); p->SamplersUsed = 0x1; /* sampler 0 (bit 0) is used */ st->drawpix.z_shader = (struct st_fragment_program *) p; @@ -358,7 +358,7 @@ make_texture(struct st_context *st, } { - struct pipe_surface *surface; + struct pipe_transfer *transfer; static const GLuint dstImageOffsets = 0; GLboolean success; GLubyte *dest; @@ -367,14 +367,14 @@ make_texture(struct st_context *st, /* we'll do pixel transfer in a fragment shader */ ctx->_ImageTransferState = 0x0; - surface = screen->get_tex_surface(screen, pt, 0, 0, 0, - PIPE_BUFFER_USAGE_CPU_WRITE); + transfer = screen->get_tex_transfer(screen, pt, 0, 0, 0, + PIPE_TRANSFER_WRITE, 0, 0, + width, height); - /* map texture surface */ - dest = screen->surface_map(screen, surface, - PIPE_BUFFER_USAGE_CPU_WRITE); + /* map texture transfer */ + dest = screen->transfer_map(screen, transfer); - /* Put image into texture surface. + /* Put image into texture transfer. * Note that the image is actually going to be upside down in * the texture. We deal with that with texcoords. */ @@ -383,7 +383,7 @@ make_texture(struct st_context *st, mformat, /* gl_texture_format */ dest, /* dest */ 0, 0, 0, /* dstX/Y/Zoffset */ - surface->stride, /* dstRowStride, bytes */ + transfer->stride, /* dstRowStride, bytes */ &dstImageOffsets, /* dstImageOffsets */ width, height, 1, /* size */ format, type, /* src format/type */ @@ -391,8 +391,8 @@ make_texture(struct st_context *st, unpack); /* unmap */ - screen->surface_unmap(screen, surface); - pipe_surface_reference(&surface, NULL); + screen->transfer_unmap(screen, transfer); + screen->tex_transfer_release(screen, &transfer); assert(success); @@ -485,14 +485,11 @@ draw_quad(GLcontext *ctx, GLfloat x0, GLfloat y0, GLfloat z, { struct pipe_buffer *buf; - ubyte *map; /* allocate/load buffer object with vertex data */ buf = pipe_buffer_create(pipe->screen, 32, PIPE_BUFFER_USAGE_VERTEX, sizeof(verts)); - map = pipe_buffer_map(pipe->screen, buf, PIPE_BUFFER_USAGE_CPU_WRITE); - memcpy(map, verts, sizeof(verts)); - pipe_buffer_unmap(pipe->screen, buf); + pipe_buffer_write(pipe->screen, buf, 0, sizeof(verts), verts); util_draw_vertex_buffer(pipe, buf, 0, PIPE_PRIM_QUADS, @@ -740,7 +737,7 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y, struct pipe_context *pipe = st->pipe; struct pipe_screen *screen = pipe->screen; struct st_renderbuffer *strb; - struct pipe_surface *ps; + struct pipe_transfer *pt; const GLboolean zoom = ctx->Pixel.ZoomX != 1.0 || ctx->Pixel.ZoomY != 1.0; GLint skipPixels; ubyte *stmap; @@ -749,21 +746,20 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y, strb = st_renderbuffer(ctx->DrawBuffer-> Attachment[BUFFER_STENCIL].Renderbuffer); - ps = screen->get_tex_surface(screen, strb->texture, 0, 0, 0, - PIPE_BUFFER_USAGE_CPU_WRITE); + pt = screen->get_tex_transfer(screen, strb->texture, 0, 0, 0, + PIPE_TRANSFER_WRITE, x, y, + width, height); - /* map the stencil buffer */ - stmap = screen->surface_map(screen, ps, - PIPE_BUFFER_USAGE_CPU_WRITE); + stmap = screen->transfer_map(screen, pt); /* if width > MAX_WIDTH, have to process image in chunks */ skipPixels = 0; while (skipPixels < width) { - const GLint spanX = x + skipPixels; + const GLint spanX = skipPixels; const GLint spanWidth = MIN2(width - skipPixels, MAX_WIDTH); GLint row; for (row = 0; row < height; row++) { - GLint spanY = y + row; + GLint spanY = row; GLubyte values[MAX_WIDTH]; GLenum destType = GL_UNSIGNED_BYTE; const GLvoid *source = _mesa_image_address2d(unpack, pixels, @@ -775,25 +771,25 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y, ctx->_ImageTransferState); if (zoom) { /* - _swrast_write_zoomed_stencil_span(ctx, x, y, spanWidth, + _swrast_write_zoomed_stencil_span(ctx, 0, 0, spanWidth, spanX, spanY, values); */ } else { if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP) { - spanY = ctx->DrawBuffer->Height - spanY - 1; + spanY = height - spanY - 1; } - switch (ps->format) { + switch (pt->format) { case PIPE_FORMAT_S8_UNORM: { - ubyte *dest = stmap + spanY * ps->stride + spanX; + ubyte *dest = stmap + spanY * pt->stride + spanX; memcpy(dest, values, spanWidth); } break; case PIPE_FORMAT_S8Z24_UNORM: { - uint *dest = (uint *) (stmap + spanY * ps->stride + spanX*4); + uint *dest = (uint *) (stmap + spanY * pt->stride + spanX*4); GLint k; for (k = 0; k < spanWidth; k++) { uint p = dest[k]; @@ -811,8 +807,8 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y, } /* unmap the stencil buffer */ - screen->surface_unmap(screen, ps); - pipe_surface_reference(&ps, NULL); + screen->transfer_unmap(screen, pt); + screen->tex_transfer_release(screen, &pt); } @@ -891,12 +887,12 @@ copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy, { struct st_renderbuffer *rbDraw = st_renderbuffer(ctx->DrawBuffer->_StencilBuffer); struct pipe_screen *screen = ctx->st->pipe->screen; - struct pipe_surface *psDraw; + struct pipe_transfer *ptDraw; ubyte *drawMap; ubyte *buffer; int i; - buffer = malloc(width * height * sizeof(ubyte)); + buffer = _mesa_malloc(width * height * sizeof(ubyte)); if (!buffer) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyPixels(stencil)"); return; @@ -906,14 +902,15 @@ copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy, st_read_stencil_pixels(ctx, srcx, srcy, width, height, GL_UNSIGNED_BYTE, &ctx->DefaultPacking, buffer); - psDraw = screen->get_tex_surface(screen, rbDraw->texture, 0, 0, 0, - PIPE_BUFFER_USAGE_CPU_WRITE); + ptDraw = screen->get_tex_transfer(screen, rbDraw->texture, 0, 0, 0, + PIPE_TRANSFER_WRITE, dstx, dsty, + width, height); - assert(psDraw->block.width == 1); - assert(psDraw->block.height == 1); + assert(ptDraw->block.width == 1); + assert(ptDraw->block.height == 1); /* map the stencil buffer */ - drawMap = screen->surface_map(screen, psDraw, PIPE_BUFFER_USAGE_CPU_WRITE); + drawMap = screen->transfer_map(screen, ptDraw); /* draw */ /* XXX PixelZoom not handled yet */ @@ -922,16 +919,16 @@ copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy, const ubyte *src; int y; - y = dsty + i; + y = i; if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP) { - y = ctx->DrawBuffer->Height - y - 1; + y = height - y - 1; } - dst = drawMap + y * psDraw->stride + dstx * psDraw->block.size; + dst = drawMap + y * ptDraw->stride; src = buffer + i * width; - switch (psDraw->format) { + switch (ptDraw->format) { case PIPE_FORMAT_S8Z24_UNORM: { uint *dst4 = (uint *) dst; @@ -950,11 +947,11 @@ copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy, } } - free(buffer); + _mesa_free(buffer); /* unmap the stencil buffer */ - screen->surface_unmap(screen, psDraw); - pipe_surface_reference(&psDraw, NULL); + screen->transfer_unmap(screen, ptDraw); + screen->tex_transfer_release(screen, &ptDraw); } @@ -969,7 +966,6 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy, struct st_renderbuffer *rbRead; struct st_vertex_program *stvp; struct st_fragment_program *stfp; - struct pipe_surface *psTex; struct pipe_texture *pt; GLfloat *color; enum pipe_format srcFormat, texFormat; @@ -1035,7 +1031,7 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy, struct pipe_surface *psRead = screen->get_tex_surface(screen, rbRead->texture, 0, 0, 0, PIPE_BUFFER_USAGE_GPU_READ); - psTex = screen->get_tex_surface(screen, pt, 0, 0, 0, + struct pipe_surface *psTex = screen->get_tex_surface(screen, pt, 0, 0, 0, PIPE_BUFFER_USAGE_GPU_WRITE ); pipe->surface_copy(pipe, FALSE, @@ -1043,37 +1039,40 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy, 0, 0, /* destx/y */ psRead, srcx, srcy, width, height); - pipe_surface_reference(&psRead, NULL); + pipe_surface_reference(&psRead, NULL); + pipe_surface_reference(&psTex, NULL); } else { /* CPU-based fallback/conversion */ - struct pipe_surface *psRead = screen->get_tex_surface(screen, - rbRead->texture, 0, 0, 0, - PIPE_BUFFER_USAGE_CPU_READ); + struct pipe_transfer *ptRead = + screen->get_tex_transfer(screen, rbRead->texture, 0, 0, 0, + PIPE_TRANSFER_READ, srcx, srcy, width, + height); - psTex = screen->get_tex_surface(screen, pt, 0, 0, 0, - PIPE_BUFFER_USAGE_CPU_WRITE ); + struct pipe_transfer *ptTex = + screen->get_tex_transfer(screen, pt, 0, 0, 0, PIPE_TRANSFER_WRITE, + 0, 0, width, height); if (type == GL_COLOR) { /* alternate path using get/put_tile() */ - GLfloat *buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat)); + GLfloat *buf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat)); - pipe_get_tile_rgba(psRead, srcx, srcy, width, height, buf); - pipe_put_tile_rgba(psTex, 0, 0, width, height, buf); + pipe_get_tile_rgba(ptRead, 0, 0, width, height, buf); + pipe_put_tile_rgba(ptTex, 0, 0, width, height, buf); - free(buf); + _mesa_free(buf); } else { /* GL_DEPTH */ - GLuint *buf = (GLuint *) malloc(width * height * sizeof(GLuint)); - pipe_get_tile_z(psRead, srcx, srcy, width, height, buf); - pipe_put_tile_z(psTex, 0, 0, width, height, buf); - free(buf); + GLuint *buf = (GLuint *) _mesa_malloc(width * height * sizeof(GLuint)); + pipe_get_tile_z(ptRead, 0, 0, width, height, buf); + pipe_put_tile_z(ptTex, 0, 0, width, height, buf); + _mesa_free(buf); } - pipe_surface_reference(&psRead, NULL); - } - pipe_surface_reference(&psTex, NULL); + screen->tex_transfer_release(screen, &ptRead); + screen->tex_transfer_release(screen, &ptTex); + } /* draw textured quad */ draw_textured_quad(ctx, dstx, dsty, ctx->Current.RasterPos[2], diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index eece7dee11..15bd6fee05 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -42,7 +42,7 @@ #include "pipe/p_context.h" #include "pipe/p_defines.h" #include "pipe/p_inlines.h" -#include "pipe/p_winsys.h" +#include "pipe/p_screen.h" #include "st_context.h" #include "st_cb_fbo.h" #include "st_cb_texture.h" @@ -118,7 +118,7 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb, template.height[0] = height; template.depth[0] = 1; template.last_level = 0; - template.nr_samples = rb->Samples; + template.nr_samples = rb->NumSamples; if (pf_is_depth_stencil(template.format)) { template.tex_usage = PIPE_TEXTURE_USAGE_DEPTH_STENCIL; @@ -171,14 +171,9 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb, surface_usage ); assert(strb->surface->texture); - assert(strb->surface->buffer); assert(strb->surface->format); - assert(strb->surface->block.size); - assert(strb->surface->block.width); - assert(strb->surface->block.height); assert(strb->surface->width == width); assert(strb->surface->height == height); - assert(strb->surface->stride); return strb->surface != NULL; @@ -195,7 +190,7 @@ st_renderbuffer_delete(struct gl_renderbuffer *rb) ASSERT(strb); pipe_surface_reference(&strb->surface, NULL); pipe_texture_reference(&strb->texture, NULL); - free(strb); + _mesa_free(strb); } @@ -233,7 +228,7 @@ st_new_framebuffer(GLcontext *ctx, GLuint name) static struct gl_renderbuffer * st_new_renderbuffer(GLcontext *ctx, GLuint name) { - struct st_renderbuffer *strb = CALLOC_STRUCT(st_renderbuffer); + struct st_renderbuffer *strb = ST_CALLOC_STRUCT(st_renderbuffer); if (strb) { _mesa_init_renderbuffer(&strb->Base, name); strb->Base.Delete = st_renderbuffer_delete; @@ -255,7 +250,7 @@ st_new_renderbuffer_fb(enum pipe_format format, int samples) { struct st_renderbuffer *strb; - strb = CALLOC_STRUCT(st_renderbuffer); + strb = ST_CALLOC_STRUCT(st_renderbuffer); if (!strb) { _mesa_error(NULL, GL_OUT_OF_MEMORY, "creating renderbuffer"); return NULL; @@ -263,7 +258,7 @@ st_new_renderbuffer_fb(enum pipe_format format, int samples) _mesa_init_renderbuffer(&strb->Base, 0); strb->Base.ClassID = 0x4242; /* just a unique value */ - strb->Base.Samples = samples; + strb->Base.NumSamples = samples; strb->format = format; switch (format) { @@ -354,11 +349,13 @@ st_render_texture(GLcontext *ctx, { struct st_renderbuffer *strb; struct gl_renderbuffer *rb; - struct pipe_texture *pt; + struct pipe_texture *pt = st_get_texobj_texture(att->Texture); struct st_texture_object *stObj; const struct gl_texture_image *texImage = att->Texture->Image[att->CubeMapFace][att->TextureLevel]; + if (!pt) + return; assert(!att->Renderbuffer); @@ -387,8 +384,6 @@ st_render_texture(GLcontext *ctx, rb->Height = texImage->Height2; /*printf("***** render to texture level %d: %d x %d\n", att->TextureLevel, rb->Width, rb->Height);*/ - pt = st_get_texobj_texture(att->Texture); - assert(pt); /*printf("***** pipe texture %d x %d\n", pt->width[0], pt->height[0]);*/ pipe_texture_reference( &strb->texture, pt ); @@ -444,6 +439,25 @@ st_finish_render_texture(GLcontext *ctx, } +/** + * Check that the framebuffer configuration is valid in terms of what + * the driver can support. + * + * For Gallium we only supports combined Z+stencil, not separate buffers. + */ +static void +st_validate_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb) +{ + const struct gl_renderbuffer *depthRb = + fb->Attachment[BUFFER_DEPTH].Renderbuffer; + const struct gl_renderbuffer *stencilRb = + fb->Attachment[BUFFER_STENCIL].Renderbuffer; + + if (stencilRb && depthRb && stencilRb != depthRb) { + fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT; + } +} + void st_init_fbo_functions(struct dd_function_table *functions) { @@ -453,6 +467,7 @@ void st_init_fbo_functions(struct dd_function_table *functions) functions->FramebufferRenderbuffer = st_framebuffer_renderbuffer; functions->RenderTexture = st_render_texture; functions->FinishRenderTexture = st_finish_render_texture; + functions->ValidateFramebuffer = st_validate_framebuffer; /* no longer needed by core Mesa, drivers handle resizes... functions->ResizeBuffers = st_resize_buffers; */ diff --git a/src/mesa/state_tracker/st_cb_feedback.c b/src/mesa/state_tracker/st_cb_feedback.c index 19021411cf..93f7145219 100644 --- a/src/mesa/state_tracker/st_cb_feedback.c +++ b/src/mesa/state_tracker/st_cb_feedback.c @@ -52,7 +52,6 @@ #include "pipe/p_context.h" #include "pipe/p_defines.h" -#include "pipe/p_winsys.h" #include "cso_cache/cso_cache.h" #include "draw/draw_context.h" @@ -123,8 +122,8 @@ feedback_tri( struct draw_stage *stage, struct prim_header *prim ) { struct feedback_stage *fs = feedback_stage(stage); struct draw_context *draw = stage->draw; - FEEDBACK_TOKEN(fs->ctx, (GLfloat) GL_POLYGON_TOKEN); - FEEDBACK_TOKEN(fs->ctx, (GLfloat) 3); /* three vertices */ + _mesa_feedback_token(fs->ctx, (GLfloat) GL_POLYGON_TOKEN); + _mesa_feedback_token(fs->ctx, (GLfloat) 3); /* three vertices */ feedback_vertex(fs->ctx, draw, prim->v[0]); feedback_vertex(fs->ctx, draw, prim->v[1]); feedback_vertex(fs->ctx, draw, prim->v[2]); @@ -137,11 +136,11 @@ feedback_line( struct draw_stage *stage, struct prim_header *prim ) struct feedback_stage *fs = feedback_stage(stage); struct draw_context *draw = stage->draw; if (fs->reset_stipple_counter) { - FEEDBACK_TOKEN(fs->ctx, (GLfloat) GL_LINE_RESET_TOKEN); + _mesa_feedback_token(fs->ctx, (GLfloat) GL_LINE_RESET_TOKEN); fs->reset_stipple_counter = GL_FALSE; } else { - FEEDBACK_TOKEN(fs->ctx, (GLfloat) GL_LINE_TOKEN); + _mesa_feedback_token(fs->ctx, (GLfloat) GL_LINE_TOKEN); } feedback_vertex(fs->ctx, draw, prim->v[0]); feedback_vertex(fs->ctx, draw, prim->v[1]); @@ -153,7 +152,7 @@ feedback_point( struct draw_stage *stage, struct prim_header *prim ) { struct feedback_stage *fs = feedback_stage(stage); struct draw_context *draw = stage->draw; - FEEDBACK_TOKEN(fs->ctx, (GLfloat) GL_POINT_TOKEN); + _mesa_feedback_token(fs->ctx, (GLfloat) GL_POINT_TOKEN); feedback_vertex(fs->ctx, draw, prim->v[0]); } @@ -185,7 +184,7 @@ feedback_destroy( struct draw_stage *stage ) static struct draw_stage * draw_glfeedback_stage(GLcontext *ctx, struct draw_context *draw) { - struct feedback_stage *fs = CALLOC_STRUCT(feedback_stage); + struct feedback_stage *fs = ST_CALLOC_STRUCT(feedback_stage); fs->stage.draw = draw; fs->stage.next = NULL; @@ -258,7 +257,7 @@ select_destroy( struct draw_stage *stage ) static struct draw_stage * draw_glselect_stage(GLcontext *ctx, struct draw_context *draw) { - struct feedback_stage *fs = CALLOC_STRUCT(feedback_stage); + struct feedback_stage *fs = ST_CALLOC_STRUCT(feedback_stage); fs->stage.draw = draw; fs->stage.next = NULL; diff --git a/src/mesa/state_tracker/st_cb_flush.c b/src/mesa/state_tracker/st_cb_flush.c index 072f2e92ad..f8621ab125 100644 --- a/src/mesa/state_tracker/st_cb_flush.c +++ b/src/mesa/state_tracker/st_cb_flush.c @@ -42,7 +42,7 @@ #include "st_public.h" #include "pipe/p_context.h" #include "pipe/p_defines.h" -#include "pipe/p_winsys.h" +#include "pipe/p_screen.h" #include "util/u_gen_mipmap.h" #include "util/u_blit.h" @@ -55,7 +55,7 @@ is_front_buffer_dirty(struct st_context *st) /** - * Tell the winsys to display the front color buffer on-screen. + * Tell the screen to display the front color buffer on-screen. */ static void display_front_buffer(struct st_context *st) @@ -67,7 +67,7 @@ display_front_buffer(struct st_context *st) /* Hook for copying "fake" frontbuffer if necessary: */ - st->pipe->winsys->flush_frontbuffer( st->pipe->winsys, front_surf, + st->pipe->screen->flush_frontbuffer( st->pipe->screen, front_surf, st->pipe->priv ); /* @@ -103,8 +103,8 @@ void st_finish( struct st_context *st ) st_flush(st, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, &fence); if(fence) { - st->pipe->winsys->fence_finish(st->pipe->winsys, fence, 0); - st->pipe->winsys->fence_reference(st->pipe->winsys, &fence, NULL); + st->pipe->screen->fence_finish(st->pipe->screen, fence, 0); + st->pipe->screen->fence_reference(st->pipe->screen, &fence, NULL); } } diff --git a/src/mesa/state_tracker/st_cb_program.c b/src/mesa/state_tracker/st_cb_program.c index ea0fa20012..4398ab2839 100644 --- a/src/mesa/state_tracker/st_cb_program.c +++ b/src/mesa/state_tracker/st_cb_program.c @@ -99,7 +99,7 @@ static struct gl_program *st_new_program( GLcontext *ctx, { switch (target) { case GL_VERTEX_PROGRAM_ARB: { - struct st_vertex_program *prog = CALLOC_STRUCT(st_vertex_program); + struct st_vertex_program *prog = ST_CALLOC_STRUCT(st_vertex_program); prog->serialNo = SerialNo++; @@ -111,7 +111,7 @@ static struct gl_program *st_new_program( GLcontext *ctx, case GL_FRAGMENT_PROGRAM_ARB: case GL_FRAGMENT_PROGRAM_NV: { - struct st_fragment_program *prog = CALLOC_STRUCT(st_fragment_program); + struct st_fragment_program *prog = ST_CALLOC_STRUCT(st_fragment_program); prog->serialNo = SerialNo++; @@ -152,7 +152,7 @@ st_delete_program(GLcontext *ctx, struct gl_program *prog) } if (stvp->state.tokens) { - FREE((void *) stvp->state.tokens); + _mesa_free((void *) stvp->state.tokens); stvp->state.tokens = NULL; } } @@ -167,7 +167,7 @@ st_delete_program(GLcontext *ctx, struct gl_program *prog) } if (stfp->state.tokens) { - FREE((void *) stfp->state.tokens); + _mesa_free((void *) stfp->state.tokens); stfp->state.tokens = NULL; } @@ -214,7 +214,7 @@ static void st_program_string_notify( GLcontext *ctx, } if (stfp->state.tokens) { - FREE((void *) stfp->state.tokens); + _mesa_free((void *) stfp->state.tokens); stfp->state.tokens = NULL; } @@ -242,7 +242,7 @@ static void st_program_string_notify( GLcontext *ctx, } if (stvp->state.tokens) { - FREE((void *) stvp->state.tokens); + _mesa_free((void *) stvp->state.tokens); stvp->state.tokens = NULL; } diff --git a/src/mesa/state_tracker/st_cb_queryobj.c b/src/mesa/state_tracker/st_cb_queryobj.c index 21c2c7dd9f..dcf4c38eb6 100644 --- a/src/mesa/state_tracker/st_cb_queryobj.c +++ b/src/mesa/state_tracker/st_cb_queryobj.c @@ -64,7 +64,7 @@ st_query_object(struct gl_query_object *q) static struct gl_query_object * st_NewQueryObject(GLcontext *ctx, GLuint id) { - struct st_query_object *stq = CALLOC_STRUCT(st_query_object); + struct st_query_object *stq = ST_CALLOC_STRUCT(st_query_object); if (stq) { stq->base.Id = id; stq->base.Ready = GL_TRUE; @@ -87,7 +87,7 @@ st_DeleteQuery(GLcontext *ctx, struct gl_query_object *q) stq->pq = NULL; } - FREE(stq); + _mesa_free(stq); } diff --git a/src/mesa/state_tracker/st_cb_rasterpos.c b/src/mesa/state_tracker/st_cb_rasterpos.c index 3eaccb74e1..7dd2352739 100644 --- a/src/mesa/state_tracker/st_cb_rasterpos.c +++ b/src/mesa/state_tracker/st_cb_rasterpos.c @@ -102,7 +102,7 @@ rastpos_line( struct draw_stage *stage, struct prim_header *prim ) static void rastpos_destroy(struct draw_stage *stage) { - free(stage); + _mesa_free(stage); } @@ -162,7 +162,7 @@ rastpos_point(struct draw_stage *stage, struct prim_header *prim) ctx->Current.RasterSecondaryColor, VERT_RESULT_COL1, VERT_ATTRIB_COLOR1); - for (i = 0; i < MAX_TEXTURE_UNITS; i++) { + for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) { update_attrib(ctx, outputMapping, prim->v[0], ctx->Current.RasterTexCoords[i], VERT_RESULT_TEX0 + i, VERT_ATTRIB_TEX0 + i); @@ -180,7 +180,7 @@ rastpos_point(struct draw_stage *stage, struct prim_header *prim) static struct rastpos_stage * new_draw_rastpos_stage(GLcontext *ctx, struct draw_context *draw) { - struct rastpos_stage *rs = CALLOC_STRUCT(rastpos_stage); + struct rastpos_stage *rs = ST_CALLOC_STRUCT(rastpos_stage); GLuint i; rs->stage.draw = draw; diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c index 646eaff190..5a4a7f0a61 100644 --- a/src/mesa/state_tracker/st_cb_readpixels.c +++ b/src/mesa/state_tracker/st_cb_readpixels.c @@ -63,44 +63,48 @@ st_read_stencil_pixels(GLcontext *ctx, GLint x, GLint y, struct gl_framebuffer *fb = ctx->ReadBuffer; struct pipe_screen *screen = ctx->st->pipe->screen; struct st_renderbuffer *strb = st_renderbuffer(fb->_StencilBuffer); - struct pipe_surface *ps; + struct pipe_transfer *pt; ubyte *stmap; GLint j; - /* Create a CPU-READ surface/view into the renderbuffer's texture */ - ps = screen->get_tex_surface(screen, strb->texture, 0, 0, 0, - PIPE_BUFFER_USAGE_CPU_READ); + if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP) { + y = ctx->DrawBuffer->Height - y - 1; + } + + /* Create a read transfer from the renderbuffer's texture */ + pt = screen->get_tex_transfer(screen, strb->texture, 0, 0, 0, + PIPE_TRANSFER_READ, x, y, width, height); /* map the stencil buffer */ - stmap = screen->surface_map(screen, ps, PIPE_BUFFER_USAGE_CPU_READ); + stmap = screen->transfer_map(screen, pt); /* width should never be > MAX_WIDTH since we did clipping earlier */ ASSERT(width <= MAX_WIDTH); /* process image row by row */ - for (j = 0; j < height; j++, y++) { + for (j = 0; j < height; j++) { GLvoid *dest; GLstencil values[MAX_WIDTH]; GLint srcY; if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP) { - srcY = ctx->DrawBuffer->Height - y - 1; + srcY = height - j - 1; } else { - srcY = y; + srcY = j; } /* get stencil values */ - switch (ps->format) { + switch (pt->format) { case PIPE_FORMAT_S8_UNORM: { - const ubyte *src = stmap + srcY * ps->stride + x; + const ubyte *src = stmap + srcY * pt->stride; memcpy(values, src, width); } break; case PIPE_FORMAT_S8Z24_UNORM: { - const uint *src = (uint *) (stmap + srcY * ps->stride + x*4); + const uint *src = (uint *) (stmap + srcY * pt->stride); GLint k; for (k = 0; k < width; k++) { values[k] = src[k] >> 24; @@ -109,7 +113,7 @@ st_read_stencil_pixels(GLcontext *ctx, GLint x, GLint y, break; case PIPE_FORMAT_Z24S8_UNORM: { - const uint *src = (uint *) (stmap + srcY * ps->stride + x*4); + const uint *src = (uint *) (stmap + srcY * pt->stride); GLint k; for (k = 0; k < width; k++) { values[k] = src[k] & 0xff; @@ -129,8 +133,8 @@ st_read_stencil_pixels(GLcontext *ctx, GLint x, GLint y, /* unmap the stencil buffer */ - screen->surface_unmap(screen, ps); - pipe_surface_reference(&ps, NULL); + screen->transfer_unmap(screen, pt); + screen->tex_transfer_release(screen, &pt); } @@ -203,28 +207,33 @@ st_fast_readpixels(GLcontext *ctx, struct st_renderbuffer *strb, { struct pipe_context *pipe = ctx->st->pipe; struct pipe_screen *screen = pipe->screen; - struct pipe_surface *surf; + struct pipe_transfer *trans; const GLubyte *map; GLubyte *dst; GLint row, col, dy, dstStride; - surf = screen->get_tex_surface(screen, strb->texture, 0, 0, 0, - PIPE_BUFFER_USAGE_CPU_READ); - if (!surf) { + if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) { + y = strb->texture->height[0] - y - height; + } + + trans = screen->get_tex_transfer(screen, strb->texture, 0, 0, 0, + PIPE_TRANSFER_READ, x, y, width, height); + if (!trans) { return GL_FALSE; } - map = screen->surface_map(screen, surf, PIPE_BUFFER_USAGE_CPU_READ); + map = screen->transfer_map(screen, trans); if (!map) { - pipe_surface_reference(&surf, NULL); + screen->tex_transfer_release(screen, &trans); return GL_FALSE; } if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) { - y = surf->height - y - 1; + y = height - 1; dy = -1; } else { + y = 0; dy = 1; } @@ -235,7 +244,7 @@ st_fast_readpixels(GLcontext *ctx, struct st_renderbuffer *strb, switch (combo) { case A8R8G8B8_UNORM_TO_RGBA_UBYTE: for (row = 0; row < height; row++) { - const GLubyte *src = map + y * surf->stride + x * 4; + const GLubyte *src = map + y * trans->stride; for (col = 0; col < width; col++) { GLuint pixel = ((GLuint *) src)[col]; dst[col*4+0] = (pixel >> 16) & 0xff; @@ -249,7 +258,7 @@ st_fast_readpixels(GLcontext *ctx, struct st_renderbuffer *strb, break; case A8R8G8B8_UNORM_TO_RGB_UBYTE: for (row = 0; row < height; row++) { - const GLubyte *src = map + y * surf->stride + x * 4; + const GLubyte *src = map + y * trans->stride; for (col = 0; col < width; col++) { GLuint pixel = ((GLuint *) src)[col]; dst[col*3+0] = (pixel >> 16) & 0xff; @@ -262,7 +271,7 @@ st_fast_readpixels(GLcontext *ctx, struct st_renderbuffer *strb, break; case A8R8G8B8_UNORM_TO_BGRA_UINT: for (row = 0; row < height; row++) { - const GLubyte *src = map + y * surf->stride + x * 4; + const GLubyte *src = map + y * trans->stride; memcpy(dst, src, 4 * width); dst += dstStride; y += dy; @@ -272,8 +281,8 @@ st_fast_readpixels(GLcontext *ctx, struct st_renderbuffer *strb, ; /* nothing */ } - screen->surface_unmap(screen, surf); - pipe_surface_reference(&surf, NULL); + screen->transfer_unmap(screen, trans); + screen->tex_transfer_release(screen, &trans); } return GL_TRUE; @@ -281,7 +290,7 @@ st_fast_readpixels(GLcontext *ctx, struct st_renderbuffer *strb, /** - * Do glReadPixels by getting rows from the framebuffer surface with + * Do glReadPixels by getting rows from the framebuffer transfer with * get_tile(). Convert to requested format/type with Mesa image routines. * Image transfer ops are done in software too. */ @@ -300,7 +309,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLfloat *df; struct st_renderbuffer *strb; struct gl_pixelstore_attrib clippedPacking = *pack; - struct pipe_surface *surf; + struct pipe_transfer *trans; assert(ctx->ReadBuffer->Width > 0); @@ -309,7 +318,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, /* Do all needed clipping here, so that we can forget about it later */ if (!_mesa_clip_readpixels(ctx, &x, &y, &width, &height, &clippedPacking)) { - /* The ReadPixels surface is totally outside the window bounds */ + /* The ReadPixels transfer is totally outside the window bounds */ return; } @@ -355,21 +364,26 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, dfStride = 0; } + if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) { + y = strb->Base.Height - y - height; + } + + /* Create a read transfer from the renderbuffer's texture */ + trans = screen->get_tex_transfer(screen, strb->texture, 0, 0, 0, + PIPE_TRANSFER_READ, x, y, width, height); + /* determine bottom-to-top vs. top-to-bottom order */ if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) { - y = strb->Base.Height - 1 - y; + y = height - 1; yStep = -1; } else { + y = 0; yStep = 1; } - /* Create a CPU-READ surface/view into the renderbuffer's texture */ - surf = screen->get_tex_surface(screen, strb->texture, 0, 0, 0, - PIPE_BUFFER_USAGE_CPU_READ); - /* - * Copy pixels from pipe_surface to user memory + * Copy pixels from pipe_transfer to user memory */ { /* dest of first pixel in client memory */ @@ -379,14 +393,14 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, const GLint dstStride = _mesa_image_row_stride(&clippedPacking, width, format, type); - if (surf->format == PIPE_FORMAT_S8Z24_UNORM || - surf->format == PIPE_FORMAT_X8Z24_UNORM) { + if (trans->format == PIPE_FORMAT_S8Z24_UNORM || + trans->format == PIPE_FORMAT_X8Z24_UNORM) { if (format == GL_DEPTH_COMPONENT) { for (i = 0; i < height; i++) { GLuint ztemp[MAX_WIDTH]; GLfloat zfloat[MAX_WIDTH]; const double scale = 1.0 / ((1 << 24) - 1); - pipe_get_tile_raw(surf, x, y, width, 1, ztemp, 0); + pipe_get_tile_raw(trans, 0, y, width, 1, ztemp, 0); y += yStep; for (j = 0; j < width; j++) { zfloat[j] = (float) (scale * (ztemp[j] & 0xffffff)); @@ -400,18 +414,18 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, /* untested, but simple: */ assert(format == GL_DEPTH_STENCIL_EXT); for (i = 0; i < height; i++) { - pipe_get_tile_raw(surf, x, y, width, 1, dst, 0); + pipe_get_tile_raw(trans, 0, y, width, 1, dst, 0); y += yStep; dst += dstStride; } } } - else if (surf->format == PIPE_FORMAT_Z16_UNORM) { + else if (trans->format == PIPE_FORMAT_Z16_UNORM) { for (i = 0; i < height; i++) { GLushort ztemp[MAX_WIDTH]; GLfloat zfloat[MAX_WIDTH]; const double scale = 1.0 / 0xffff; - pipe_get_tile_raw(surf, x, y, width, 1, ztemp, 0); + pipe_get_tile_raw(trans, 0, y, width, 1, ztemp, 0); y += yStep; for (j = 0; j < width; j++) { zfloat[j] = (float) (scale * ztemp[j]); @@ -421,12 +435,12 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, dst += dstStride; } } - else if (surf->format == PIPE_FORMAT_Z32_UNORM) { + else if (trans->format == PIPE_FORMAT_Z32_UNORM) { for (i = 0; i < height; i++) { GLuint ztemp[MAX_WIDTH]; GLfloat zfloat[MAX_WIDTH]; const double scale = 1.0 / 0xffffffff; - pipe_get_tile_raw(surf, x, y, width, 1, ztemp, 0); + pipe_get_tile_raw(trans, 0, y, width, 1, ztemp, 0); y += yStep; for (j = 0; j < width; j++) { zfloat[j] = (float) (scale * ztemp[j]); @@ -440,7 +454,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, /* RGBA format */ /* Do a row at a time to flip image data vertically */ for (i = 0; i < height; i++) { - pipe_get_tile_rgba(surf, x, y, width, 1, df); + pipe_get_tile_rgba(trans, 0, y, width, 1, df); y += yStep; df += dfStride; if (!dfStride) { @@ -452,7 +466,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, } } - pipe_surface_reference(&surf, NULL); + screen->tex_transfer_release(screen, &trans); _mesa_unmap_readpix_pbo(ctx, &clippedPacking); } diff --git a/src/mesa/state_tracker/st_cb_strings.c b/src/mesa/state_tracker/st_cb_strings.c index 066124f8f3..2036ccafbf 100644 --- a/src/mesa/state_tracker/st_cb_strings.c +++ b/src/mesa/state_tracker/st_cb_strings.c @@ -36,11 +36,10 @@ #include "main/version.h" #include "pipe/p_context.h" #include "pipe/p_screen.h" -#include "pipe/p_winsys.h" #include "st_context.h" #include "st_cb_strings.h" -#define ST_VERSION_STRING "0.1" +#define ST_VERSION_STRING "0.2" static const GLubyte * st_get_string(GLcontext * ctx, GLenum name) @@ -67,10 +66,9 @@ st_get_string(GLcontext * ctx, GLenum name) } case GL_RENDERER: - util_snprintf(st->renderer, sizeof(st->renderer), "Gallium %s, %s on %s", + util_snprintf(st->renderer, sizeof(st->renderer), "Gallium %s on %s", ST_VERSION_STRING, - screen->get_name( screen ), - screen->winsys->get_name( screen->winsys )); + screen->get_name( screen )); return (GLubyte *) st->renderer; diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 0b2b639a5b..3039eb2a87 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -25,12 +25,13 @@ * **************************************************************************/ -#include "main/imports.h" +#include "main/mfeatures.h" #if FEATURE_convolve #include "main/convolve.h" #endif #include "main/enums.h" #include "main/image.h" +#include "main/imports.h" #include "main/macros.h" #include "main/mipmap.h" #include "main/pixel.h" @@ -114,7 +115,7 @@ st_NewTextureImage(GLcontext * ctx) { DBG("%s\n", __FUNCTION__); (void) ctx; - return (struct gl_texture_image *) CALLOC_STRUCT(st_texture_image); + return (struct gl_texture_image *) ST_CALLOC_STRUCT(st_texture_image); } @@ -122,7 +123,7 @@ st_NewTextureImage(GLcontext * ctx) static struct gl_texture_object * st_NewTextureObject(GLcontext * ctx, GLuint name, GLenum target) { - struct st_texture_object *obj = CALLOC_STRUCT(st_texture_object); + struct st_texture_object *obj = ST_CALLOC_STRUCT(st_texture_object); DBG("%s\n", __FUNCTION__); _mesa_initialize_texture_object(&obj->base, name, target); @@ -524,9 +525,10 @@ st_TexImage(GLcontext * ctx, if (stImage->pt) { texImage->Data = st_texture_image_map(ctx->st, stImage, 0, - PIPE_BUFFER_USAGE_CPU_WRITE); - if (stImage->surface) - dstRowStride = stImage->surface->stride; + PIPE_TRANSFER_WRITE, 0, 0, + stImage->base.Width, + stImage->base.Height); + dstRowStride = stImage->transfer->stride; } else { /* Allocate regular memory and store the image there temporarily. */ @@ -581,7 +583,9 @@ st_TexImage(GLcontext * ctx, if (stImage->pt && i < depth) { st_texture_image_unmap(ctx->st, stImage); texImage->Data = st_texture_image_map(ctx->st, stImage, i, - PIPE_BUFFER_USAGE_CPU_WRITE); + PIPE_TRANSFER_WRITE, 0, 0, + stImage->base.Width, + stImage->base.Height); src += srcImageStride; } } @@ -688,8 +692,10 @@ st_get_tex_image(GLcontext * ctx, GLenum target, GLint level, * kernel. Need to explicitly map and unmap it. */ texImage->Data = st_texture_image_map(ctx->st, stImage, 0, - PIPE_BUFFER_USAGE_CPU_READ); - texImage->RowStride = stImage->surface->stride / stImage->pt->block.size; + PIPE_TRANSFER_READ, 0, 0, + stImage->base.Width, + stImage->base.Height); + texImage->RowStride = stImage->transfer->stride / stImage->pt->block.size; } else { /* Otherwise, the image should actually be stored in @@ -720,7 +726,9 @@ st_get_tex_image(GLcontext * ctx, GLenum target, GLint level, if (stImage->pt && i < depth) { st_texture_image_unmap(ctx->st, stImage); texImage->Data = st_texture_image_map(ctx->st, stImage, i, - PIPE_BUFFER_USAGE_CPU_READ); + PIPE_TRANSFER_READ, 0, 0, + stImage->base.Width, + stImage->base.Height); dest += dstImageStride; } } @@ -749,8 +757,8 @@ st_GetTexImage(GLcontext * ctx, GLenum target, GLint level, static void st_GetCompressedTexImage(GLcontext *ctx, GLenum target, GLint level, GLvoid *pixels, - const struct gl_texture_object *texObj, - const struct gl_texture_image *texImage) + struct gl_texture_object *texObj, + struct gl_texture_image *texImage) { st_get_tex_image(ctx, target, level, 0, 0, pixels, (struct gl_texture_object *) texObj, @@ -792,9 +800,11 @@ st_TexSubimage(GLcontext * ctx, */ if (stImage->pt) { texImage->Data = st_texture_image_map(ctx->st, stImage, zoffset, - PIPE_BUFFER_USAGE_CPU_WRITE); - if (stImage->surface) - dstRowStride = stImage->surface->stride; + PIPE_TRANSFER_WRITE, + xoffset, yoffset, + stImage->base.Width, + stImage->base.Height); + dstRowStride = stImage->transfer->stride; } if (!texImage->Data) { @@ -808,7 +818,7 @@ st_TexSubimage(GLcontext * ctx, if (!texImage->TexFormat->StoreImage(ctx, dims, texImage->_BaseFormat, texImage->TexFormat, texImage->Data, - xoffset, yoffset, 0, + 0, 0, 0, dstRowStride, texImage->ImageOffsets, width, height, 1, @@ -820,7 +830,10 @@ st_TexSubimage(GLcontext * ctx, /* map next slice of 3D texture */ st_texture_image_unmap(ctx->st, stImage); texImage->Data = st_texture_image_map(ctx->st, stImage, zoffset + i, - PIPE_BUFFER_USAGE_CPU_WRITE); + PIPE_TRANSFER_WRITE, + xoffset, yoffset, + stImage->base.Width, + stImage->base.Height); src += srcImageStride; } } @@ -898,26 +911,8 @@ st_TexSubImage1D(GLcontext * ctx, /** - * Return 0 for GL_TEXTURE_CUBE_MAP_POSITIVE_X, - * 1 for GL_TEXTURE_CUBE_MAP_NEGATIVE_X, - * etc. - * XXX duplicated from main/teximage.c - */ -static uint -texture_face(GLenum target) -{ - if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && - target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) - return (GLuint) target - (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X; - else - return 0; -} - - - -/** - * Do a CopyTexSubImage operation by mapping the source surface and - * dest surface and using get_tile()/put_tile() to access the pixels/texels. + * Do a CopyTexSubImage operation using a read transfer from the source, a write + * transfer to the destination and get_tile()/put_tile() to access the pixels/texels. * * Note: srcY=0=TOP of renderbuffer */ @@ -934,20 +929,24 @@ fallback_copy_texsubimage(GLcontext *ctx, { struct pipe_context *pipe = ctx->st->pipe; struct pipe_screen *screen = pipe->screen; - const uint face = texture_face(target); - struct pipe_texture *pt = stImage->pt; - struct pipe_surface *src_surf, *dest_surf; + struct pipe_transfer *src_trans; + GLvoid *texDest; - /* We'd use strb->surface, here but it's created for GPU read/write only */ - src_surf = pipe->screen->get_tex_surface( pipe->screen, - strb->texture, - 0, 0, 0, - PIPE_BUFFER_USAGE_CPU_READ); + assert(width <= MAX_WIDTH); - dest_surf = screen->get_tex_surface(screen, pt, face, level, destZ, - PIPE_BUFFER_USAGE_CPU_WRITE); + if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) { + srcY = strb->Base.Height - srcY - height; + } - assert(width <= MAX_WIDTH); + src_trans = pipe->screen->get_tex_transfer( pipe->screen, + strb->texture, + 0, 0, 0, + PIPE_TRANSFER_READ, + srcX, srcY, + width, height); + + texDest = st_texture_image_map(ctx->st, stImage, 0, PIPE_TRANSFER_WRITE, + destX, destY, width, height); if (baseFormat == GL_DEPTH_COMPONENT) { const GLboolean scaleOrBias = (ctx->Pixel.DepthScale != 1.0F || @@ -956,39 +955,36 @@ fallback_copy_texsubimage(GLcontext *ctx, /* determine bottom-to-top vs. top-to-bottom order for src buffer */ if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) { - srcY = strb->Base.Height - 1 - srcY; + srcY = height - 1; yStep = -1; } else { + srcY = 0; yStep = 1; } /* To avoid a large temp memory allocation, do copy row by row */ - for (row = 0; row < height; row++, srcY += yStep, destY++) { + for (row = 0; row < height; row++, srcY += yStep) { uint data[MAX_WIDTH]; - pipe_get_tile_z(src_surf, srcX, srcY, width, 1, data); + pipe_get_tile_z(src_trans, 0, srcY, width, 1, data); if (scaleOrBias) { _mesa_scale_and_bias_depth_uint(ctx, width, data); } - pipe_put_tile_z(dest_surf, destX, destY, width, 1, data); + pipe_put_tile_z(stImage->transfer, 0, row, width, 1, data); } } else { /* RGBA format */ GLfloat *tempSrc = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat)); - GLvoid *texDest = - st_texture_image_map(ctx->st, stImage, 0,PIPE_BUFFER_USAGE_CPU_WRITE); if (tempSrc && texDest) { const GLint dims = 2; struct gl_texture_image *texImage = &stImage->base; - GLint dstRowStride = stImage->surface->stride; + GLint dstRowStride = stImage->transfer->stride; struct gl_pixelstore_attrib unpack = ctx->DefaultPacking; if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) { - /* need to invert src */ - srcY = strb->Base.Height - srcY - height; unpack.Invert = GL_TRUE; } @@ -996,7 +992,7 @@ fallback_copy_texsubimage(GLcontext *ctx, /* XXX this usually involves a lot of int/float conversion. * try to avoid that someday. */ - pipe_get_tile_rgba(src_surf, srcX, srcY, width, height, tempSrc); + pipe_get_tile_rgba(src_trans, 0, 0, width, height, tempSrc); /* Store into texture memory. * Note that this does some special things such as pixel transfer @@ -1008,7 +1004,7 @@ fallback_copy_texsubimage(GLcontext *ctx, texImage->_BaseFormat, texImage->TexFormat, texDest, - destX, destY, destZ, + 0, 0, 0, dstRowStride, texImage->ImageOffsets, width, height, 1, @@ -1021,12 +1017,10 @@ fallback_copy_texsubimage(GLcontext *ctx, if (tempSrc) _mesa_free(tempSrc); - if (texDest) - st_texture_image_unmap(ctx->st, stImage); } - screen->tex_surface_release(screen, &dest_surf); - screen->tex_surface_release(screen, &src_surf); + st_texture_image_unmap(ctx->st, stImage); + screen->tex_transfer_release(screen, &src_trans); } @@ -1417,9 +1411,7 @@ st_finalize_texture(GLcontext *ctx, stObj->pt->width[0] != firstImage->base.Width2 || stObj->pt->height[0] != firstImage->base.Height2 || stObj->pt->depth[0] != firstImage->base.Depth2 || - stObj->pt->block.size != cpp || - stObj->pt->block.width != 1 || - stObj->pt->block.height != 1 || + stObj->pt->block.size/stObj->pt->block.width != cpp || /* Nominal bytes per pixel */ stObj->pt->compressed != firstImage->base.IsCompressed) { pipe_texture_release(&stObj->pt); ctx->st->dirty.st |= ST_NEW_FRAMEBUFFER; diff --git a/src/mesa/state_tracker/wgl/stw_wgl_arbextensionsstring.c b/src/mesa/state_tracker/st_cb_viewport.c index 04865796ec..75b0a219ce 100644 --- a/src/mesa/state_tracker/wgl/stw_wgl_arbextensionsstring.c +++ b/src/mesa/state_tracker/st_cb_viewport.c @@ -1,6 +1,6 @@ /************************************************************************** * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. + * Copyright 2009 VMware, Inc. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -25,18 +25,29 @@ * **************************************************************************/ -#include <windows.h> +#include "main/glheader.h" +#include "st_context.h" +#include "st_public.h" +#include "st_cb_viewport.h" -#include "stw_wgl_arbextensionsstring.h" +#include "pipe/p_context.h" +#include "pipe/p_inlines.h" +#include "pipe/p_state.h" +#include "pipe/p_defines.h" +#include "pipe/internal/p_winsys_screen.h" -WINGDIAPI const char * APIENTRY -wglGetExtensionsStringARB( - HDC hdc ) + +static void st_viewport(GLcontext * ctx, GLint x, GLint y, + GLsizei width, GLsizei height) { - (void) hdc; + struct st_context *st = ctx->st; + + if (st->pipe->winsys && st->pipe->winsys->update_buffer) + st->pipe->winsys->update_buffer( st->pipe->winsys, + st->pipe->priv ); +} - return - "WGL_ARB_extensions_string " - "WGL_ARB_multisample " - "WGL_ARB_pixel_format"; +void st_init_viewport_functions(struct dd_function_table *functions) +{ + functions->Viewport = st_viewport; } diff --git a/src/mesa/state_tracker/wgl/stw_wgl_arbmultisample.c b/src/mesa/state_tracker/st_cb_viewport.h index aad04e3e8a..44948e5316 100644 --- a/src/mesa/state_tracker/wgl/stw_wgl_arbmultisample.c +++ b/src/mesa/state_tracker/st_cb_viewport.h @@ -1,6 +1,6 @@ /************************************************************************** * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. + * Copyright 2009 VMware, Inc. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -25,17 +25,5 @@ * **************************************************************************/ -#include <windows.h> -#include "stw_wgl_arbmultisample.h" - -int -wgl_query_sample_buffers( void ) -{ - return 1; -} - -int -wgl_query_samples( void ) -{ - return 4; -} +extern void +st_init_viewport_functions(struct dd_function_table *functions); diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index cca808d328..78a7956c90 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -59,6 +59,7 @@ #include "st_cb_texture.h" #include "st_cb_flush.h" #include "st_cb_strings.h" +#include "st_cb_viewport.h" #include "st_atom.h" #include "st_draw.h" #include "st_extensions.h" @@ -105,7 +106,7 @@ static struct st_context * st_create_context_priv( GLcontext *ctx, struct pipe_context *pipe ) { uint i; - struct st_context *st = CALLOC_STRUCT( st_context ); + struct st_context *st = ST_CALLOC_STRUCT( st_context ); ctx->st = st; @@ -148,7 +149,6 @@ st_create_context_priv( GLcontext *ctx, struct pipe_context *pipe ) /* Need these flags: */ st->ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE; - st->ctx->FragmentProgram._UseTexEnvProgram = GL_TRUE; st->ctx->VertexProgram._MaintainTnlProgram = GL_TRUE; @@ -218,7 +218,7 @@ static void st_destroy_context_priv( struct st_context *st ) st->default_texture = NULL; } - free( st ); + _mesa_free( st ); } @@ -246,7 +246,7 @@ void st_destroy_context( struct st_context *st ) pipe->destroy( pipe ); - free(ctx); + _mesa_free(ctx); } @@ -321,6 +321,7 @@ void st_init_driver_functions(struct dd_function_table *functions) st_init_texture_functions(functions); st_init_flush_functions(functions); st_init_string_functions(functions); + st_init_viewport_functions(functions); functions->UpdateState = st_invalidate_state; } diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h index 695ac4a96f..3547925ad7 100644 --- a/src/mesa/state_tracker/st_context.h +++ b/src/mesa/state_tracker/st_context.h @@ -242,6 +242,10 @@ st_fb_orientation(const struct gl_framebuffer *fb) } +/** clear-alloc a struct-sized object, with casting */ +#define ST_CALLOC_STRUCT(T) (struct T *) _mesa_calloc(sizeof(struct T)) + + extern int st_get_msaa(void); diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c index e78d98f1e9..b52e488612 100644 --- a/src/mesa/state_tracker/st_draw.c +++ b/src/mesa/state_tracker/st_draw.c @@ -223,7 +223,7 @@ setup_edgeflags(GLcontext *ctx, GLenum primMode, GLint start, GLint count, if (!stobj) return NULL; - vec = (unsigned *) calloc(sizeof(unsigned), (count + 31) / 32); + vec = (unsigned *) _mesa_calloc(sizeof(unsigned) * ((count + 31) / 32)); if (!vec) return NULL; @@ -301,18 +301,17 @@ is_interleaved_arrays(const struct st_vertex_program *vp, } *userSpace = (num_client_arrays == vp->num_inputs); - /*printf("user space: %d\n", (int) *userSpace);*/ + /* printf("user space: %d (%d %d)\n", (int) *userSpace,num_client_arrays,vp->num_inputs); */ return GL_TRUE; } /** - * Once we know all the arrays are in user space, this function - * computes the memory range occupied by the arrays. + * Compute the memory range occupied by the arrays. */ static void -get_user_arrays_bounds(const struct st_vertex_program *vp, +get_arrays_bounds(const struct st_vertex_program *vp, const struct gl_client_array **arrays, GLuint max_index, const GLubyte **low, const GLubyte **high) @@ -366,22 +365,23 @@ setup_interleaved_attribs(GLcontext *ctx, /*printf("stobj %u = %p\n", attr, (void*)stobj);*/ if (attr == 0) { + const GLubyte *low, *high; + + get_arrays_bounds(vp, arrays, max_index, &low, &high); + /*printf("buffer range: %p %p %d\n", low, high, high-low);*/ + + offset0 = low; if (userSpace) { - const GLubyte *low, *high; - get_user_arrays_bounds(vp, arrays, max_index, &low, &high); - /*printf("user buffer range: %p %p %d\n", low, high, high-low);*/ vbuffer->buffer = pipe_user_buffer_create(pipe->screen, (void *) low, high - low); vbuffer->buffer_offset = 0; - offset0 = low; } else { vbuffer->buffer = NULL; pipe_buffer_reference(pipe->screen, &vbuffer->buffer, stobj->buffer); - vbuffer->buffer_offset = (unsigned) arrays[mesaAttr]->Ptr; - offset0 = arrays[mesaAttr]->Ptr; + vbuffer->buffer_offset = (unsigned) low; } - vbuffer->pitch = stride; /* in bytes */ + vbuffer->stride = stride; /* in bytes */ vbuffer->max_index = max_index; } @@ -472,7 +472,7 @@ setup_non_interleaved_attribs(GLcontext *ctx, assert(velements[attr].src_offset <= 2048); /* 11-bit field */ /* common-case setup */ - vbuffer[attr].pitch = stride; /* in bytes */ + vbuffer[attr].stride = stride; /* in bytes */ vbuffer[attr].max_index = max_index; velements[attr].vertex_buffer_index = attr; velements[attr].nr_components = arrays[mesaAttr]->Size; @@ -541,9 +541,11 @@ st_draw_vbo(GLcontext *ctx, vp = ctx->st->vp; vs = &ctx->st->vp->state; +#if 0 if (MESA_VERBOSE & VERBOSE_GLSL) { check_uniforms(ctx); } +#endif /* * Setup the vbuffer[] and velements[] arrays. @@ -569,7 +571,7 @@ st_draw_vbo(GLcontext *ctx, { GLuint i; for (i = 0; i < num_vbuffers; i++) { - printf("buffers[%d].pitch = %u\n", i, vbuffer[i].pitch); + printf("buffers[%d].stride = %u\n", i, vbuffer[i].stride); printf("buffers[%d].max_index = %u\n", i, vbuffer[i].max_index); printf("buffers[%d].buffer_offset = %u\n", i, vbuffer[i].buffer_offset); printf("buffers[%d].buffer = %p\n", i, (void*) vbuffer[i].buffer); diff --git a/src/mesa/state_tracker/st_draw_feedback.c b/src/mesa/state_tracker/st_draw_feedback.c index 834c3844c4..5c9c4506c2 100644 --- a/src/mesa/state_tracker/st_draw_feedback.c +++ b/src/mesa/state_tracker/st_draw_feedback.c @@ -171,7 +171,7 @@ st_feedback_draw_vbo(GLcontext *ctx, } /* common-case setup */ - vbuffers[attr].pitch = arrays[mesaAttr]->StrideB; /* in bytes */ + vbuffers[attr].stride = arrays[mesaAttr]->StrideB; /* in bytes */ vbuffers[attr].max_index = max_index; velements[attr].vertex_buffer_index = attr; velements[attr].nr_components = arrays[mesaAttr]->Size; diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 60fd440ef7..8f6be50774 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -1,6 +1,7 @@ /************************************************************************** * * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. + * Copyright (c) 2008 VMware, Inc. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -83,12 +84,19 @@ void st_init_limits(struct st_context *st) c->MaxTextureRectSize = _min(1 << (c->MaxTextureLevels - 1), MAX_TEXTURE_RECT_SIZE); - c->MaxTextureUnits - = c->MaxTextureImageUnits - = c->MaxTextureCoordUnits + c->MaxTextureImageUnits = _min(screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS), MAX_TEXTURE_IMAGE_UNITS); + c->MaxVertexTextureImageUnits + = _min(screen->get_param(screen, PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS), + MAX_VERTEX_TEXTURE_IMAGE_UNITS); + + c->MaxTextureCoordUnits + = _min(c->MaxTextureImageUnits, MAX_TEXTURE_COORD_UNITS); + + c->MaxTextureUnits = _min(c->MaxTextureImageUnits, c->MaxTextureCoordUnits); + c->MaxDrawBuffers = _clamp(screen->get_param(screen, PIPE_CAP_MAX_RENDER_TARGETS), 1, MAX_DRAW_BUFFERS); @@ -116,7 +124,11 @@ void st_init_limits(struct st_context *st) /** - * XXX this needs careful review + * Use pipe_screen::get_param() to query PIPE_CAP_ values to determine + * which GL extensions are supported. + * Quite a few extensions are always supported because they are standard + * features or can be built on top of other gallium features. + * Some fine tuning may still be needed. */ void st_init_extensions(struct st_context *st) { @@ -126,10 +138,10 @@ void st_init_extensions(struct st_context *st) /* * Extensions that are supported by all Gallium drivers: */ - ctx->Extensions.ARB_multisample = GL_TRUE; /* API support */ + ctx->Extensions.ARB_multisample = GL_TRUE; ctx->Extensions.ARB_fragment_program = GL_TRUE; ctx->Extensions.ARB_texture_border_clamp = GL_TRUE; /* XXX temp */ - ctx->Extensions.ARB_texture_compression = GL_TRUE; /* API support only */ + ctx->Extensions.ARB_texture_compression = GL_TRUE; ctx->Extensions.ARB_texture_cube_map = GL_TRUE; ctx->Extensions.ARB_texture_env_combine = GL_TRUE; ctx->Extensions.ARB_texture_env_crossbar = GL_TRUE; @@ -160,7 +172,7 @@ void st_init_extensions(struct st_context *st) ctx->Extensions.NV_texgen_reflection = GL_TRUE; ctx->Extensions.SGI_color_matrix = GL_TRUE; - ctx->Extensions.SGIS_generate_mipmap = GL_TRUE; /* XXX temp */ + ctx->Extensions.SGIS_generate_mipmap = GL_TRUE; /* * Extensions that depend on the driver/hardware: @@ -196,6 +208,7 @@ void st_init_extensions(struct st_context *st) if (screen->get_param(screen, PIPE_CAP_TWO_SIDED_STENCIL)) { ctx->Extensions.ATI_separate_stencil = GL_TRUE; + ctx->Extensions.EXT_stencil_two_side = GL_TRUE; } if (screen->get_param(screen, PIPE_CAP_ANISOTROPIC_FILTER)) { @@ -238,19 +251,24 @@ void st_init_extensions(struct st_context *st) ctx->Extensions.EXT_packed_depth_stencil = GL_TRUE; } + /* sRGB support */ if (screen->is_format_supported(screen, PIPE_FORMAT_R8G8B8A8_SRGB, PIPE_TEXTURE_2D, + PIPE_TEXTURE_USAGE_SAMPLER, 0) || + screen->is_format_supported(screen, PIPE_FORMAT_A8R8G8B8_SRGB, + PIPE_TEXTURE_2D, PIPE_TEXTURE_USAGE_SAMPLER, 0)) { ctx->Extensions.EXT_texture_sRGB = GL_TRUE; } -#if 01 + /* s3tc support */ if (screen->is_format_supported(screen, PIPE_FORMAT_DXT5_RGBA, PIPE_TEXTURE_2D, PIPE_TEXTURE_USAGE_SAMPLER, 0)) { ctx->Extensions.EXT_texture_compression_s3tc = GL_TRUE; } -#endif + + /* ycbcr support */ if (screen->is_format_supported(screen, PIPE_FORMAT_YCBCR, PIPE_TEXTURE_2D, PIPE_TEXTURE_USAGE_SAMPLER, 0) || @@ -259,5 +277,4 @@ void st_init_extensions(struct st_context *st) PIPE_TEXTURE_USAGE_SAMPLER, 0)) { ctx->Extensions.MESA_ycbcr_texture = GL_TRUE; } - } diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c index a8ae30a454..9e2d60c926 100644 --- a/src/mesa/state_tracker/st_format.c +++ b/src/mesa/state_tracker/st_format.c @@ -1,6 +1,7 @@ /************************************************************************** * * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. + * Copyright (c) 2008 VMware, Inc. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -263,6 +264,28 @@ st_mesa_format_to_pipe_format(GLuint mesaFormat) return PIPE_FORMAT_DXT3_RGBA; case MESA_FORMAT_RGBA_DXT5: return PIPE_FORMAT_DXT5_RGBA; +#if FEATURE_EXT_texture_sRGB + case MESA_FORMAT_SRGB_DXT1: + return PIPE_FORMAT_DXT1_SRGB; + case MESA_FORMAT_SRGBA_DXT1: + return PIPE_FORMAT_DXT1_SRGBA; + case MESA_FORMAT_SRGBA_DXT3: + return PIPE_FORMAT_DXT3_SRGBA; + case MESA_FORMAT_SRGBA_DXT5: + return PIPE_FORMAT_DXT5_SRGBA; +#endif +#endif +#if FEATURE_EXT_texture_sRGB + case MESA_FORMAT_SLA8: + return PIPE_FORMAT_A8L8_SRGB; + case MESA_FORMAT_SL8: + return PIPE_FORMAT_L8_SRGB; + case MESA_FORMAT_SRGB8: + return PIPE_FORMAT_R8G8B8_SRGB; + case MESA_FORMAT_SRGBA8: + return PIPE_FORMAT_R8G8B8A8_SRGB; + case MESA_FORMAT_SARGB8: + return PIPE_FORMAT_A8R8G8B8_SRGB; #endif default: assert(0); @@ -294,6 +317,28 @@ default_rgba_format(struct pipe_screen *screen, return PIPE_FORMAT_NONE; } +/** + * Find an sRGBA format supported by the context/winsys. + */ +static enum pipe_format +default_srgba_format(struct pipe_screen *screen, + enum pipe_texture_target target, + unsigned tex_usage, + unsigned geom_flags) +{ + static const enum pipe_format colorFormats[] = { + PIPE_FORMAT_A8R8G8B8_SRGB, + PIPE_FORMAT_B8G8R8A8_SRGB, + PIPE_FORMAT_R8G8B8A8_SRGB, + }; + uint i; + for (i = 0; i < Elements(colorFormats); i++) { + if (screen->is_format_supported( screen, colorFormats[i], target, tex_usage, geom_flags )) { + return colorFormats[i]; + } + } + return PIPE_FORMAT_NONE; +} /** * Search list of formats for first RGBA format with >8 bits/channel. @@ -512,6 +557,36 @@ st_choose_format(struct pipe_context *pipe, GLint internalFormat, return PIPE_FORMAT_Z24S8_UNORM; return PIPE_FORMAT_NONE; + case GL_SRGB_EXT: + case GL_SRGB8_EXT: + case GL_COMPRESSED_SRGB_EXT: + case GL_COMPRESSED_SRGB_ALPHA_EXT: + case GL_SRGB_ALPHA_EXT: + case GL_SRGB8_ALPHA8_EXT: + return default_srgba_format( screen, target, tex_usage, geom_flags ); + case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT: + return PIPE_FORMAT_DXT1_SRGB; + case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: + return PIPE_FORMAT_DXT1_SRGBA; + case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: + return PIPE_FORMAT_DXT3_SRGBA; + case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: + return PIPE_FORMAT_DXT5_SRGBA; + + case GL_SLUMINANCE_ALPHA_EXT: + case GL_SLUMINANCE8_ALPHA8_EXT: + case GL_COMPRESSED_SLUMINANCE_EXT: + case GL_COMPRESSED_SLUMINANCE_ALPHA_EXT: + if (screen->is_format_supported( screen, PIPE_FORMAT_A8L8_SRGB, target, tex_usage, geom_flags )) + return PIPE_FORMAT_A8L8_SRGB; + return default_srgba_format( screen, target, tex_usage, geom_flags ); + + case GL_SLUMINANCE_EXT: + case GL_SLUMINANCE8_EXT: + if (screen->is_format_supported( screen, PIPE_FORMAT_L8_SRGB, target, tex_usage, geom_flags )) + return PIPE_FORMAT_L8_SRGB; + return default_srgba_format( screen, target, tex_usage, geom_flags ); + default: return PIPE_FORMAT_NONE; } @@ -591,6 +666,28 @@ translate_gallium_format_to_mesa_format(enum pipe_format format) return &_mesa_texformat_rgba_dxt3; case PIPE_FORMAT_DXT5_RGBA: return &_mesa_texformat_rgba_dxt5; +#if FEATURE_EXT_texture_sRGB + case PIPE_FORMAT_DXT1_SRGB: + return &_mesa_texformat_srgb_dxt1; + case PIPE_FORMAT_DXT1_SRGBA: + return &_mesa_texformat_srgba_dxt1; + case PIPE_FORMAT_DXT3_SRGBA: + return &_mesa_texformat_srgba_dxt3; + case PIPE_FORMAT_DXT5_SRGBA: + return &_mesa_texformat_srgba_dxt5; +#endif +#endif +#if FEATURE_EXT_texture_sRGB + case PIPE_FORMAT_A8L8_SRGB: + return &_mesa_texformat_sla8; + case PIPE_FORMAT_L8_SRGB: + return &_mesa_texformat_sl8; + case PIPE_FORMAT_R8G8B8_SRGB: + return &_mesa_texformat_srgb8; + case PIPE_FORMAT_R8G8B8A8_SRGB: + return &_mesa_texformat_srgba8; + case PIPE_FORMAT_A8R8G8B8_SRGB: + return &_mesa_texformat_sargb8; #endif /* XXX add additional cases */ default: diff --git a/src/mesa/state_tracker/st_framebuffer.c b/src/mesa/state_tracker/st_framebuffer.c index 7d270a3272..0d4474a8b3 100644 --- a/src/mesa/state_tracker/st_framebuffer.c +++ b/src/mesa/state_tracker/st_framebuffer.c @@ -33,9 +33,9 @@ #include "main/matrix.h" #include "main/renderbuffer.h" #include "main/scissor.h" -#include "st_public.h" #include "st_context.h" #include "st_cb_fbo.h" +#include "st_public.h" #include "pipe/p_defines.h" #include "pipe/p_context.h" #include "pipe/p_inlines.h" @@ -49,7 +49,7 @@ st_create_framebuffer( const __GLcontextModes *visual, uint width, uint height, void *private) { - struct st_framebuffer *stfb = CALLOC_STRUCT(st_framebuffer); + struct st_framebuffer *stfb = ST_CALLOC_STRUCT(st_framebuffer); if (stfb) { int samples = st_get_msaa(); @@ -153,9 +153,9 @@ void st_resize_framebuffer( struct st_framebuffer *stfb, } -void st_unreference_framebuffer( struct st_framebuffer **stfb ) +void st_unreference_framebuffer( struct st_framebuffer *stfb ) { - _mesa_unreference_framebuffer((struct gl_framebuffer **) stfb); + _mesa_unreference_framebuffer((struct gl_framebuffer **) &stfb); } @@ -169,6 +169,7 @@ void st_set_framebuffer_surface(struct st_framebuffer *stfb, uint surfIndex, struct pipe_surface *surf) { + GET_CURRENT_CONTEXT(ctx); static const GLuint invalid_size = 9999999; struct st_renderbuffer *strb; GLuint width, height, i; @@ -176,12 +177,23 @@ st_set_framebuffer_surface(struct st_framebuffer *stfb, assert(surfIndex < BUFFER_COUNT); strb = st_renderbuffer(stfb->Base.Attachment[surfIndex].Renderbuffer); - assert(strb); + + /* fail */ + if (!strb) return; /* replace the renderbuffer's surface/texture pointers */ pipe_surface_reference( &strb->surface, surf ); pipe_texture_reference( &strb->texture, surf->texture ); + if (ctx) { + /* If ctx isn't set, we've likely not made current yet. + * But when we do, we need to start setting this dirty bit + * to ensure the renderbuffer attachements are up-to-date + * via update_framebuffer. + */ + ctx->st->dirty.st |= ST_NEW_FRAMEBUFFER; + } + /* update renderbuffer's width/height */ strb->Base.Width = surf->width; strb->Base.Height = surf->height; @@ -218,8 +230,8 @@ st_set_framebuffer_surface(struct st_framebuffer *stfb, /** * Return the pipe_surface for the given renderbuffer. */ -struct pipe_surface * -st_get_framebuffer_surface(struct st_framebuffer *stfb, uint surfIndex) +int +st_get_framebuffer_surface(struct st_framebuffer *stfb, uint surfIndex, struct pipe_surface **surface) { struct st_renderbuffer *strb; @@ -230,13 +242,17 @@ st_get_framebuffer_surface(struct st_framebuffer *stfb, uint surfIndex) assert(ST_SURFACE_BACK_RIGHT == BUFFER_BACK_RIGHT); strb = st_renderbuffer(stfb->Base.Attachment[surfIndex].Renderbuffer); - if (strb) - return strb->surface; - return NULL; + if (strb) { + *surface = strb->surface; + return GL_TRUE; + } + + *surface = NULL; + return GL_FALSE; } -struct pipe_texture * -st_get_framebuffer_texture(struct st_framebuffer *stfb, uint surfIndex) +int +st_get_framebuffer_texture(struct st_framebuffer *stfb, uint surfIndex, struct pipe_texture **texture) { struct st_renderbuffer *strb; @@ -247,9 +263,13 @@ st_get_framebuffer_texture(struct st_framebuffer *stfb, uint surfIndex) assert(ST_SURFACE_BACK_RIGHT == BUFFER_BACK_RIGHT); strb = st_renderbuffer(stfb->Base.Attachment[surfIndex].Renderbuffer); - if (strb) - return strb->texture; - return NULL; + if (strb) { + *texture = strb->texture; + return GL_TRUE; + } + + *texture = NULL; + return GL_FALSE; } /** @@ -304,3 +324,10 @@ void *st_framebuffer_private( struct st_framebuffer *stfb ) return stfb->Private; } +void st_get_framebuffer_dimensions( struct st_framebuffer *stfb, + uint *width, + uint *height) +{ + *width = stfb->Base.Width; + *height = stfb->Base.Height; +} diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c index b9d114b1c9..08e4803068 100644 --- a/src/mesa/state_tracker/st_gen_mipmap.c +++ b/src/mesa/state_tracker/st_gen_mipmap.c @@ -119,36 +119,36 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target, for (dstLevel = baseLevel + 1; dstLevel <= lastLevel; dstLevel++) { const uint srcLevel = dstLevel - 1; - struct pipe_surface *srcSurf, *dstSurf; + struct pipe_transfer *srcTrans, *dstTrans; const ubyte *srcData; ubyte *dstData; - srcSurf = screen->get_tex_surface(screen, pt, face, srcLevel, zslice, - PIPE_BUFFER_USAGE_CPU_READ); - dstSurf = screen->get_tex_surface(screen, pt, face, dstLevel, zslice, - PIPE_BUFFER_USAGE_CPU_WRITE); + srcTrans = screen->get_tex_transfer(screen, pt, face, srcLevel, zslice, + PIPE_TRANSFER_READ, 0, 0, + pt->width[srcLevel], + pt->height[srcLevel]); + dstTrans = screen->get_tex_transfer(screen, pt, face, dstLevel, zslice, + PIPE_TRANSFER_WRITE, 0, 0, + pt->width[dstLevel], + pt->height[dstLevel]); - srcData = (ubyte *) pipe_buffer_map(pipe->screen, srcSurf->buffer, - PIPE_BUFFER_USAGE_CPU_READ) - + srcSurf->offset; - dstData = (ubyte *) pipe_buffer_map(pipe->screen, dstSurf->buffer, - PIPE_BUFFER_USAGE_CPU_WRITE) - + dstSurf->offset; + srcData = (ubyte *) screen->transfer_map(screen, srcTrans); + dstData = (ubyte *) screen->transfer_map(screen, dstTrans); _mesa_generate_mipmap_level(target, datatype, comps, 0 /*border*/, pt->width[srcLevel], pt->height[srcLevel], pt->depth[srcLevel], - srcSurf->stride, /* stride in bytes */ srcData, + srcTrans->stride, /* stride in bytes */ pt->width[dstLevel], pt->height[dstLevel], pt->depth[dstLevel], - dstSurf->stride, /* stride in bytes */ - dstData); + dstData, + dstTrans->stride); /* stride in bytes */ - pipe_buffer_unmap(pipe->screen, srcSurf->buffer); - pipe_buffer_unmap(pipe->screen, dstSurf->buffer); + screen->transfer_unmap(screen, srcTrans); + screen->transfer_unmap(screen, dstTrans); - pipe_surface_reference(&srcSurf, NULL); - pipe_surface_reference(&dstSurf, NULL); + screen->tex_transfer_release(screen, &srcTrans); + screen->tex_transfer_release(screen, &dstTrans); } } @@ -160,9 +160,14 @@ st_generate_mipmap(GLcontext *ctx, GLenum target, struct st_context *st = ctx->st; struct pipe_texture *pt = st_get_texobj_texture(texObj); const uint baseLevel = texObj->BaseLevel; - const uint lastLevel = pt->last_level; + uint lastLevel; uint dstLevel; + if (!pt) + return; + + lastLevel = pt->last_level; + if (!st_render_mipmap(st, target, pt, baseLevel, lastLevel)) { fallback_generate_mipmap(ctx, target, texObj); } diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c index b3a9f6594b..8ce0b20113 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -41,7 +41,7 @@ #include "shader/prog_instruction.h" #include "shader/prog_parameter.h" #include "shader/prog_print.h" -#include "pipe/p_debug.h" +#include "util/u_debug.h" /* * Map mesa register file to TGSI register file. @@ -132,19 +132,35 @@ map_register_file_index( */ static GLuint map_texture_target( - GLuint textarget ) + GLuint textarget, + GLboolean shadow ) { +#if 1 + /* XXX remove this line after we've checked that the rest of gallium + * can handle the TGSI_TEXTURE_SHADOWx tokens. + */ + shadow = GL_FALSE; +#endif switch( textarget ) { case TEXTURE_1D_INDEX: - return TGSI_TEXTURE_1D; + if (shadow) + return TGSI_TEXTURE_SHADOW1D; + else + return TGSI_TEXTURE_1D; case TEXTURE_2D_INDEX: - return TGSI_TEXTURE_2D; + if (shadow) + return TGSI_TEXTURE_SHADOW2D; + else + return TGSI_TEXTURE_2D; case TEXTURE_3D_INDEX: return TGSI_TEXTURE_3D; case TEXTURE_CUBE_INDEX: return TGSI_TEXTURE_CUBE; case TEXTURE_RECT_INDEX: - return TGSI_TEXTURE_RECT; + if (shadow) + return TGSI_TEXTURE_SHADOWRECT; + else + return TGSI_TEXTURE_RECT; default: assert( 0 ); } @@ -188,7 +204,7 @@ make_immediate(const float *value, uint size) struct tgsi_full_immediate imm; imm = tgsi_default_full_immediate(); - imm.Immediate.Size += size; + imm.Immediate.NrTokens += size; imm.Immediate.DataType = TGSI_IMM_FLOAT32; imm.u.Pointer = value; return imm; @@ -346,6 +362,12 @@ compile_instruction( case OPCODE_DDY: fullinst->Instruction.Opcode = TGSI_OPCODE_DDY; break; + case OPCODE_DP2: + fullinst->Instruction.Opcode = TGSI_OPCODE_DP2; + break; + case OPCODE_DP2A: + fullinst->Instruction.Opcode = TGSI_OPCODE_DP2A; + break; case OPCODE_DP3: fullinst->Instruction.Opcode = TGSI_OPCODE_DP3; break; @@ -389,8 +411,8 @@ compile_instruction( fullinst->Instruction.Opcode = TGSI_OPCODE_IF; fullinst->InstructionExtLabel.Label = inst->BranchTarget + preamble_size; break; - case OPCODE_INT: - fullinst->Instruction.Opcode = TGSI_OPCODE_INT; + case OPCODE_TRUNC: + fullinst->Instruction.Opcode = TGSI_OPCODE_TRUNC; break; case OPCODE_KIL: /* conditional */ @@ -443,6 +465,12 @@ compile_instruction( case OPCODE_NOP: fullinst->Instruction.Opcode = TGSI_OPCODE_NOP; break; + case OPCODE_NRM3: + fullinst->Instruction.Opcode = TGSI_OPCODE_NRM; + break; + case OPCODE_NRM4: + fullinst->Instruction.Opcode = TGSI_OPCODE_NRM4; + break; case OPCODE_POW: fullinst->Instruction.Opcode = TGSI_OPCODE_POW; break; @@ -463,15 +491,6 @@ compile_instruction( break; case OPCODE_RSQ: fullinst->Instruction.Opcode = TGSI_OPCODE_RSQ; - - /* KW: Don't do this here. If particular hardware needs to do - * this, can do so in the driver.. - */ -#if 0 - tgsi_util_set_full_src_register_sign_mode( - &fullinst->FullSrcRegisters[0], - TGSI_UTIL_SIGN_CLEAR ); -#endif break; case OPCODE_SCS: fullinst->Instruction.Opcode = TGSI_OPCODE_SCS; @@ -498,6 +517,9 @@ compile_instruction( case OPCODE_SNE: fullinst->Instruction.Opcode = TGSI_OPCODE_SNE; break; + case OPCODE_SSG: + fullinst->Instruction.Opcode = TGSI_OPCODE_SSG; + break; case OPCODE_SUB: fullinst->Instruction.Opcode = TGSI_OPCODE_SUB; break; @@ -508,7 +530,8 @@ compile_instruction( /* ordinary texture lookup */ fullinst->Instruction.Opcode = TGSI_OPCODE_TEX; fullinst->Instruction.NumSrcRegs = 2; - fullinst->InstructionExtTexture.Texture = map_texture_target( inst->TexSrcTarget ); + fullinst->InstructionExtTexture.Texture = + map_texture_target( inst->TexSrcTarget, inst->TexShadow ); fullinst->FullSrcRegisters[1].SrcRegister.File = TGSI_FILE_SAMPLER; fullinst->FullSrcRegisters[1].SrcRegister.Index = inst->TexSrcUnit; break; @@ -516,7 +539,8 @@ compile_instruction( /* texture lookup with LOD bias */ fullinst->Instruction.Opcode = TGSI_OPCODE_TXB; fullinst->Instruction.NumSrcRegs = 2; - fullinst->InstructionExtTexture.Texture = map_texture_target( inst->TexSrcTarget ); + fullinst->InstructionExtTexture.Texture = + map_texture_target( inst->TexSrcTarget, inst->TexShadow ); fullinst->FullSrcRegisters[1].SrcRegister.File = TGSI_FILE_SAMPLER; fullinst->FullSrcRegisters[1].SrcRegister.Index = inst->TexSrcUnit; break; @@ -524,7 +548,8 @@ compile_instruction( /* texture lookup with explicit partial derivatives */ fullinst->Instruction.Opcode = TGSI_OPCODE_TXD; fullinst->Instruction.NumSrcRegs = 4; - fullinst->InstructionExtTexture.Texture = map_texture_target( inst->TexSrcTarget ); + fullinst->InstructionExtTexture.Texture = + map_texture_target( inst->TexSrcTarget, inst->TexShadow ); /* src[0] = coord, src[1] = d[strq]/dx, src[2] = d[strq]/dy */ fullinst->FullSrcRegisters[3].SrcRegister.File = TGSI_FILE_SAMPLER; fullinst->FullSrcRegisters[3].SrcRegister.Index = inst->TexSrcUnit; @@ -533,7 +558,8 @@ compile_instruction( /* texture lookup with explicit LOD */ fullinst->Instruction.Opcode = TGSI_OPCODE_TXL; fullinst->Instruction.NumSrcRegs = 2; - fullinst->InstructionExtTexture.Texture = map_texture_target( inst->TexSrcTarget ); + fullinst->InstructionExtTexture.Texture = + map_texture_target( inst->TexSrcTarget, inst->TexShadow ); fullinst->FullSrcRegisters[1].SrcRegister.File = TGSI_FILE_SAMPLER; fullinst->FullSrcRegisters[1].SrcRegister.Index = inst->TexSrcUnit; break; @@ -542,7 +568,8 @@ compile_instruction( /* convert to TEX w/ special flag for division */ fullinst->Instruction.Opcode = TGSI_OPCODE_TXP; fullinst->Instruction.NumSrcRegs = 2; - fullinst->InstructionExtTexture.Texture = map_texture_target( inst->TexSrcTarget ); + fullinst->InstructionExtTexture.Texture = + map_texture_target( inst->TexSrcTarget, inst->TexShadow ); fullinst->FullSrcRegisters[1].SrcRegister.File = TGSI_FILE_SAMPLER; fullinst->FullSrcRegisters[1].SrcRegister.Index = inst->TexSrcUnit; break; @@ -730,6 +757,7 @@ find_temporaries(const struct gl_program *program, */ GLuint st_translate_mesa_program( + GLcontext *ctx, uint procType, const struct gl_program *program, GLuint numInputs, @@ -977,7 +1005,7 @@ st_translate_mesa_program( } /* texture samplers */ - for (i = 0; i < 8; i++) { + for (i = 0; i < ctx->Const.MaxTextureImageUnits; i++) { if (program->SamplersUsed & (1 << i)) { struct tgsi_full_declaration fulldecl; diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.h b/src/mesa/state_tracker/st_mesa_to_tgsi.h index 7b2bee1ab7..b465b3bddc 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.h +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.h @@ -41,6 +41,7 @@ struct gl_program; GLuint st_translate_mesa_program( + GLcontext *ctx, uint procType, const struct gl_program *program, GLuint numInputs, diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index cf4b39cee4..f825204915 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -61,9 +61,9 @@ static INLINE void * mem_dup(const void *src, uint size) { - void *dup = MALLOC(size); + void *dup = _mesa_malloc(size); if (dup) - memcpy(dup, src, size); + _mesa_memcpy(dup, src, size); return dup; } @@ -307,7 +307,7 @@ st_translate_vertex_program(struct st_context *st, /* free old shader state, if any */ if (stvp->state.tokens) { - FREE((void *) stvp->state.tokens); + _mesa_free((void *) stvp->state.tokens); stvp->state.tokens = NULL; } if (stvp->driver_shader) { @@ -317,7 +317,8 @@ st_translate_vertex_program(struct st_context *st, /* XXX: fix static allocation of tokens: */ - num_tokens = st_translate_mesa_program(TGSI_PROCESSOR_VERTEX, + num_tokens = st_translate_mesa_program(st->ctx, + TGSI_PROCESSOR_VERTEX, &stvp->Base.Base, /* inputs */ vs_num_inputs, @@ -465,23 +466,23 @@ st_translate_fragment_program(struct st_context *st, GLbitfield outputsWritten = stfp->Base.Base.OutputsWritten; /* if z is written, emit that first */ - if (outputsWritten & (1 << FRAG_RESULT_DEPR)) { + if (outputsWritten & (1 << FRAG_RESULT_DEPTH)) { fs_output_semantic_name[fs_num_outputs] = TGSI_SEMANTIC_POSITION; fs_output_semantic_index[fs_num_outputs] = 0; - outputMapping[FRAG_RESULT_DEPR] = fs_num_outputs; + outputMapping[FRAG_RESULT_DEPTH] = fs_num_outputs; fs_num_outputs++; - outputsWritten &= ~(1 << FRAG_RESULT_DEPR); + outputsWritten &= ~(1 << FRAG_RESULT_DEPTH); } /* handle remaning outputs (color) */ for (attr = 0; attr < FRAG_RESULT_MAX; attr++) { if (outputsWritten & (1 << attr)) { switch (attr) { - case FRAG_RESULT_DEPR: + case FRAG_RESULT_DEPTH: /* handled above */ assert(0); break; - case FRAG_RESULT_COLR: + case FRAG_RESULT_COLOR: fs_output_semantic_name[fs_num_outputs] = TGSI_SEMANTIC_COLOR; fs_output_semantic_index[fs_num_outputs] = numColors; outputMapping[attr] = fs_num_outputs; @@ -503,7 +504,8 @@ st_translate_fragment_program(struct st_context *st, /* XXX: fix static allocation of tokens: */ - num_tokens = st_translate_mesa_program(TGSI_PROCESSOR_FRAGMENT, + num_tokens = st_translate_mesa_program(st->ctx, + TGSI_PROCESSOR_FRAGMENT, &stfp->Base.Base, /* inputs */ fs_num_inputs, diff --git a/src/mesa/state_tracker/st_public.h b/src/mesa/state_tracker/st_public.h index 5cfb2e41f2..414218bb58 100644 --- a/src/mesa/state_tracker/st_public.h +++ b/src/mesa/state_tracker/st_public.h @@ -42,6 +42,8 @@ #define ST_SURFACE_DEPTH 8 #define ST_TEXTURE_2D 0x2 +#define ST_TEXTURE_RECT 0x4 + #define ST_TEXTURE_RGB 0x1 #define ST_TEXTURE_RGBA 0x2 @@ -51,6 +53,7 @@ struct st_framebuffer; struct pipe_context; struct pipe_fence_handle; struct pipe_surface; +struct pipe_texture; struct st_context *st_create_context(struct pipe_context *pipe, @@ -75,15 +78,18 @@ void st_resize_framebuffer( struct st_framebuffer *stfb, void st_set_framebuffer_surface(struct st_framebuffer *stfb, uint surfIndex, struct pipe_surface *surf); -struct pipe_surface *st_get_framebuffer_surface(struct st_framebuffer *stfb, - uint surfIndex); +void st_get_framebuffer_dimensions( struct st_framebuffer *stfb, + uint *width, uint *height); + +int st_get_framebuffer_surface(struct st_framebuffer *stfb, + uint surfIndex, struct pipe_surface **surface); -struct pipe_texture *st_get_framebuffer_texture(struct st_framebuffer *stfb, - uint surfIndex); +int st_get_framebuffer_texture(struct st_framebuffer *stfb, + uint surfIndex, struct pipe_texture **texture); void *st_framebuffer_private( struct st_framebuffer *stfb ); -void st_unreference_framebuffer( struct st_framebuffer **stfb ); +void st_unreference_framebuffer( struct st_framebuffer *stfb ); void st_make_current(struct st_context *st, struct st_framebuffer *draw, @@ -96,6 +102,7 @@ void st_finish( struct st_context *st ); void st_notify_swapbuffers(struct st_framebuffer *stfb); void st_notify_swapbuffers_complete(struct st_framebuffer *stfb); +int st_set_teximage(struct pipe_texture *pt, int target); /** Redirect rendering into stfb's surface to a texture image */ int st_bind_teximage(struct st_framebuffer *stfb, uint surfIndex, diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c index 29b1634762..fcf76ef82e 100644 --- a/src/mesa/state_tracker/st_texture.c +++ b/src/mesa/state_tracker/st_texture.c @@ -32,6 +32,7 @@ #include "st_cb_fbo.h" #include "main/enums.h" #include "main/teximage.h" +#include "main/texstore.h" #undef Elements /* fix re-defined macro warning */ @@ -190,19 +191,19 @@ st_texture_image_offset(const struct pipe_texture * pt, */ GLubyte * st_texture_image_map(struct st_context *st, struct st_texture_image *stImage, - GLuint zoffset, - GLuint flags ) + GLuint zoffset, enum pipe_transfer_usage usage, + GLuint x, GLuint y, GLuint w, GLuint h) { struct pipe_screen *screen = st->pipe->screen; struct pipe_texture *pt = stImage->pt; DBG("%s \n", __FUNCTION__); - stImage->surface = screen->get_tex_surface(screen, pt, stImage->face, - stImage->level, zoffset, - flags); + stImage->transfer = screen->get_tex_transfer(screen, pt, stImage->face, + stImage->level, zoffset, + usage, x, y, w, h); - if (stImage->surface) - return screen->surface_map(screen, stImage->surface, flags); + if (stImage->transfer) + return screen->transfer_map(screen, stImage->transfer); else return NULL; } @@ -216,9 +217,9 @@ st_texture_image_unmap(struct st_context *st, DBG("%s\n", __FUNCTION__); - screen->surface_unmap(screen, stImage->surface); + screen->transfer_unmap(screen, stImage->transfer); - pipe_surface_reference(&stImage->surface, NULL); + screen->tex_transfer_release(screen, &stImage->transfer); } @@ -233,13 +234,13 @@ st_texture_image_unmap(struct st_context *st, */ static void st_surface_data(struct pipe_context *pipe, - struct pipe_surface *dst, + struct pipe_transfer *dst, unsigned dstx, unsigned dsty, const void *src, unsigned src_stride, unsigned srcx, unsigned srcy, unsigned width, unsigned height) { struct pipe_screen *screen = pipe->screen; - void *map = screen->surface_map(screen, dst, PIPE_BUFFER_USAGE_CPU_WRITE); + void *map = screen->transfer_map(screen, dst); pipe_copy_rect(map, &dst->block, @@ -249,7 +250,7 @@ st_surface_data(struct pipe_context *pipe, src, src_stride, srcx, srcy); - screen->surface_unmap(screen, dst); + screen->transfer_unmap(screen, dst); } @@ -267,21 +268,23 @@ st_texture_image_data(struct pipe_context *pipe, GLuint depth = dst->depth[level]; GLuint i; const GLubyte *srcUB = src; - struct pipe_surface *dst_surface; + struct pipe_transfer *dst_transfer; DBG("%s\n", __FUNCTION__); for (i = 0; i < depth; i++) { - dst_surface = screen->get_tex_surface(screen, dst, face, level, i, - PIPE_BUFFER_USAGE_CPU_WRITE); + dst_transfer = screen->get_tex_transfer(screen, dst, face, level, i, + PIPE_TRANSFER_WRITE, 0, 0, + dst->width[level], + dst->height[level]); - st_surface_data(pipe, dst_surface, + st_surface_data(pipe, dst_transfer, 0, 0, /* dstx, dsty */ srcUB, src_row_stride, 0, 0, /* source x, y */ dst->width[level], dst->height[level]); /* width, height */ - screen->tex_surface_release(screen, &dst_surface); + screen->tex_transfer_release(screen, &dst_transfer); srcUB += src_image_stride; } @@ -352,6 +355,52 @@ st_texture_image_copy(struct pipe_context *pipe, } } +/** Bind a pipe surface for use as a texture image */ +int +st_set_teximage(struct pipe_texture *pt, int target) +{ + GET_CURRENT_CONTEXT(ctx); + const GLuint unit = ctx->Texture.CurrentUnit; + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; + struct gl_texture_object *texObj; + struct gl_texture_image *texImage; + struct st_texture_image *stImage; + int internalFormat; + + switch (pt->format) { + case PIPE_FORMAT_A8R8G8B8_UNORM: + internalFormat = GL_RGBA8; + break; + default: + return 0; + }; + + switch (target) { + case ST_TEXTURE_2D: + target = GL_TEXTURE_2D; + break; + case ST_TEXTURE_RECT: + target = GL_TEXTURE_RECTANGLE_ARB; + break; + default: + return 0; + } + + texObj = _mesa_select_tex_object(ctx, texUnit, target); + texImage = _mesa_get_tex_image(ctx, texObj, target, 0); + stImage = st_texture_image(texImage); + + _mesa_init_teximage_fields(ctx, GL_TEXTURE_2D, texImage, pt->width[0], + pt->height[0], 1, 0, internalFormat); + + texImage->TexFormat = st_ChooseTextureFormat(ctx, internalFormat, GL_RGBA, + GL_UNSIGNED_BYTE); + _mesa_set_fetch_functions(texImage, 2); + + pipe_texture_reference(&stImage->pt, pt); + + return 1; +} /** Redirect rendering into stfb's surface to a texture image */ int @@ -380,7 +429,7 @@ st_bind_teximage(struct st_framebuffer *stfb, uint surfIndex, } if (target == ST_TEXTURE_2D) { - texObj = texUnit->Current2D; + texObj = texUnit->CurrentTex[TEXTURE_2D_INDEX]; texImage = _mesa_get_tex_image(ctx, texObj, GL_TEXTURE_2D, level); stImage = st_texture_image(texImage); } diff --git a/src/mesa/state_tracker/st_texture.h b/src/mesa/state_tracker/st_texture.h index 31f66ad52c..840b7e27cc 100644 --- a/src/mesa/state_tracker/st_texture.h +++ b/src/mesa/state_tracker/st_texture.h @@ -50,7 +50,7 @@ struct st_texture_image */ struct pipe_texture *pt; - struct pipe_surface *surface; + struct pipe_transfer *transfer; }; @@ -132,7 +132,9 @@ extern GLubyte * st_texture_image_map(struct st_context *st, struct st_texture_image *stImage, GLuint zoffset, - GLuint flags); + enum pipe_transfer_usage usage, + unsigned x, unsigned y, + unsigned w, unsigned h); extern void st_texture_image_unmap(struct st_context *st, diff --git a/src/mesa/state_tracker/wgl/SConscript b/src/mesa/state_tracker/wgl/SConscript deleted file mode 100644 index bb579930f5..0000000000 --- a/src/mesa/state_tracker/wgl/SConscript +++ /dev/null @@ -1,41 +0,0 @@ -import os - -Import('*') - -if env['platform'] in ['windows']: - - env = env.Clone() - - env.Append(CPPPATH = [ - '#src/mesa', - ]) - - env.Append(CPPDEFINES = [ - '_GDI32_', # prevent wgl* being declared __declspec(dllimport) - 'BUILD_GL32', # declare gl* as __declspec(dllexport) in Mesa headers - '__GL_EXPORTS', - '_GNU_H_WINDOWS32_DEFINES', - ]) - - sources = [ - 'stw_device.c', - 'stw_framebuffer.c', - 'stw_icd.c', - 'stw_pixelformat.c', - 'stw_quirks.c', - 'stw_wgl_arbextensionsstring.c', - 'stw_wgl_arbmultisample.c', - 'stw_wgl_arbpixelformat.c', - #'stw_wgl.c', - 'stw_wgl_context.c', - 'stw_wgl_getprocaddress.c', - 'stw_wgl_pixelformat.c', - 'stw_wgl_swapbuffers.c', - ] - - wgl = env.ConvenienceLibrary( - target ='wgl', - source = sources, - ) - - Export('wgl') diff --git a/src/mesa/state_tracker/wgl/opengl32.def b/src/mesa/state_tracker/wgl/opengl32.def deleted file mode 100644 index 238b728f1f..0000000000 --- a/src/mesa/state_tracker/wgl/opengl32.def +++ /dev/null @@ -1,879 +0,0 @@ -; DO NOT EDIT - This file generated automatically by mesadef.py script -;DESCRIPTION 'Mesa (OpenGL work-alike) for Win32' -VERSION 6.5 -; -; Module definition file for Mesa (OPENGL32.DLL) -; -; Note: The OpenGL functions use the STDCALL -; function calling convention. Microsoft's -; OPENGL32 uses this convention and so must the -; Mesa OPENGL32 so that the Mesa DLL can be used -; as a drop-in replacement. -; -; The linker exports STDCALL entry points with -; 'decorated' names; e.g., _glBegin@0, where the -; trailing number is the number of bytes of -; parameter data pushed onto the stack. The -; callee is responsible for popping this data -; off the stack, usually via a RETF n instruction. -; -; However, the Microsoft OPENGL32.DLL does not export -; the decorated names, even though the calling convention -; is STDCALL. So, this module definition file is -; needed to force the Mesa OPENGL32.DLL to export the -; symbols in the same manner as the Microsoft DLL. -; Were it not for this problem, this file would not -; be needed (for the gl* functions) since the entry -; points are compiled with dllexport declspec. -; -; However, this file is still needed to export "internal" -; Mesa symbols for the benefit of the OSMESA32.DLL. -; -EXPORTS - glNewList - glEndList - glCallList - glCallLists - glDeleteLists - glGenLists - glListBase - glBegin - glBitmap - glColor3b - glColor3bv - glColor3d - glColor3dv - glColor3f - glColor3fv - glColor3i - glColor3iv - glColor3s - glColor3sv - glColor3ub - glColor3ubv - glColor3ui - glColor3uiv - glColor3us - glColor3usv - glColor4b - glColor4bv - glColor4d - glColor4dv - glColor4f - glColor4fv - glColor4i - glColor4iv - glColor4s - glColor4sv - glColor4ub - glColor4ubv - glColor4ui - glColor4uiv - glColor4us - glColor4usv - glEdgeFlag - glEdgeFlagv - glEnd - glIndexd - glIndexdv - glIndexf - glIndexfv - glIndexi - glIndexiv - glIndexs - glIndexsv - glNormal3b - glNormal3bv - glNormal3d - glNormal3dv - glNormal3f - glNormal3fv - glNormal3i - glNormal3iv - glNormal3s - glNormal3sv - glRasterPos2d - glRasterPos2dv - glRasterPos2f - glRasterPos2fv - glRasterPos2i - glRasterPos2iv - glRasterPos2s - glRasterPos2sv - glRasterPos3d - glRasterPos3dv - glRasterPos3f - glRasterPos3fv - glRasterPos3i - glRasterPos3iv - glRasterPos3s - glRasterPos3sv - glRasterPos4d - glRasterPos4dv - glRasterPos4f - glRasterPos4fv - glRasterPos4i - glRasterPos4iv - glRasterPos4s - glRasterPos4sv - glRectd - glRectdv - glRectf - glRectfv - glRecti - glRectiv - glRects - glRectsv - glTexCoord1d - glTexCoord1dv - glTexCoord1f - glTexCoord1fv - glTexCoord1i - glTexCoord1iv - glTexCoord1s - glTexCoord1sv - glTexCoord2d - glTexCoord2dv - glTexCoord2f - glTexCoord2fv - glTexCoord2i - glTexCoord2iv - glTexCoord2s - glTexCoord2sv - glTexCoord3d - glTexCoord3dv - glTexCoord3f - glTexCoord3fv - glTexCoord3i - glTexCoord3iv - glTexCoord3s - glTexCoord3sv - glTexCoord4d - glTexCoord4dv - glTexCoord4f - glTexCoord4fv - glTexCoord4i - glTexCoord4iv - glTexCoord4s - glTexCoord4sv - glVertex2d - glVertex2dv - glVertex2f - glVertex2fv - glVertex2i - glVertex2iv - glVertex2s - glVertex2sv - glVertex3d - glVertex3dv - glVertex3f - glVertex3fv - glVertex3i - glVertex3iv - glVertex3s - glVertex3sv - glVertex4d - glVertex4dv - glVertex4f - glVertex4fv - glVertex4i - glVertex4iv - glVertex4s - glVertex4sv - glClipPlane - glColorMaterial - glCullFace - glFogf - glFogfv - glFogi - glFogiv - glFrontFace - glHint - glLightf - glLightfv - glLighti - glLightiv - glLightModelf - glLightModelfv - glLightModeli - glLightModeliv - glLineStipple - glLineWidth - glMaterialf - glMaterialfv - glMateriali - glMaterialiv - glPointSize - glPolygonMode - glPolygonStipple - glScissor - glShadeModel - glTexParameterf - glTexParameterfv - glTexParameteri - glTexParameteriv - glTexImage1D - glTexImage2D - glTexEnvf - glTexEnvfv - glTexEnvi - glTexEnviv - glTexGend - glTexGendv - glTexGenf - glTexGenfv - glTexGeni - glTexGeniv - glFeedbackBuffer - glSelectBuffer - glRenderMode - glInitNames - glLoadName - glPassThrough - glPopName - glPushName - glDrawBuffer - glClear - glClearAccum - glClearIndex - glClearColor - glClearStencil - glClearDepth - glStencilMask - glColorMask - glDepthMask - glIndexMask - glAccum - glDisable - glEnable - glFinish - glFlush - glPopAttrib - glPushAttrib - glMap1d - glMap1f - glMap2d - glMap2f - glMapGrid1d - glMapGrid1f - glMapGrid2d - glMapGrid2f - glEvalCoord1d - glEvalCoord1dv - glEvalCoord1f - glEvalCoord1fv - glEvalCoord2d - glEvalCoord2dv - glEvalCoord2f - glEvalCoord2fv - glEvalMesh1 - glEvalPoint1 - glEvalMesh2 - glEvalPoint2 - glAlphaFunc - glBlendFunc - glLogicOp - glStencilFunc - glStencilOp - glDepthFunc - glPixelZoom - glPixelTransferf - glPixelTransferi - glPixelStoref - glPixelStorei - glPixelMapfv - glPixelMapuiv - glPixelMapusv - glReadBuffer - glCopyPixels - glReadPixels - glDrawPixels - glGetBooleanv - glGetClipPlane - glGetDoublev - glGetError - glGetFloatv - glGetIntegerv - glGetLightfv - glGetLightiv - glGetMapdv - glGetMapfv - glGetMapiv - glGetMaterialfv - glGetMaterialiv - glGetPixelMapfv - glGetPixelMapuiv - glGetPixelMapusv - glGetPolygonStipple - glGetString - glGetTexEnvfv - glGetTexEnviv - glGetTexGendv - glGetTexGenfv - glGetTexGeniv - glGetTexImage - glGetTexParameterfv - glGetTexParameteriv - glGetTexLevelParameterfv - glGetTexLevelParameteriv - glIsEnabled - glIsList - glDepthRange - glFrustum - glLoadIdentity - glLoadMatrixf - glLoadMatrixd - glMatrixMode - glMultMatrixf - glMultMatrixd - glOrtho - glPopMatrix - glPushMatrix - glRotated - glRotatef - glScaled - glScalef - glTranslated - glTranslatef - glViewport - glArrayElement - glColorPointer - glDisableClientState - glDrawArrays - glDrawElements - glEdgeFlagPointer - glEnableClientState - glGetPointerv - glIndexPointer - glInterleavedArrays - glNormalPointer - glTexCoordPointer - glVertexPointer - glPolygonOffset - glCopyTexImage1D - glCopyTexImage2D - glCopyTexSubImage1D - glCopyTexSubImage2D - glTexSubImage1D - glTexSubImage2D - glAreTexturesResident - glBindTexture - glDeleteTextures - glGenTextures - glIsTexture - glPrioritizeTextures - glIndexub - glIndexubv - glPopClientAttrib - glPushClientAttrib - glBlendColor - glBlendEquation - glDrawRangeElements - glColorTable - glColorTableParameterfv - glColorTableParameteriv - glCopyColorTable - glGetColorTable - glGetColorTableParameterfv - glGetColorTableParameteriv - glColorSubTable - glCopyColorSubTable - glConvolutionFilter1D - glConvolutionFilter2D - glConvolutionParameterf - glConvolutionParameterfv - glConvolutionParameteri - glConvolutionParameteriv - glCopyConvolutionFilter1D - glCopyConvolutionFilter2D - glGetConvolutionFilter - glGetConvolutionParameterfv - glGetConvolutionParameteriv - glGetSeparableFilter - glSeparableFilter2D - glGetHistogram - glGetHistogramParameterfv - glGetHistogramParameteriv - glGetMinmax - glGetMinmaxParameterfv - glGetMinmaxParameteriv - glHistogram - glMinmax - glResetHistogram - glResetMinmax - glTexImage3D - glTexSubImage3D - glCopyTexSubImage3D - glActiveTextureARB - glClientActiveTextureARB - glMultiTexCoord1dARB - glMultiTexCoord1dvARB - glMultiTexCoord1fARB - glMultiTexCoord1fvARB - glMultiTexCoord1iARB - glMultiTexCoord1ivARB - glMultiTexCoord1sARB - glMultiTexCoord1svARB - glMultiTexCoord2dARB - glMultiTexCoord2dvARB - glMultiTexCoord2fARB - glMultiTexCoord2fvARB - glMultiTexCoord2iARB - glMultiTexCoord2ivARB - glMultiTexCoord2sARB - glMultiTexCoord2svARB - glMultiTexCoord3dARB - glMultiTexCoord3dvARB - glMultiTexCoord3fARB - glMultiTexCoord3fvARB - glMultiTexCoord3iARB - glMultiTexCoord3ivARB - glMultiTexCoord3sARB - glMultiTexCoord3svARB - glMultiTexCoord4dARB - glMultiTexCoord4dvARB - glMultiTexCoord4fARB - glMultiTexCoord4fvARB - glMultiTexCoord4iARB - glMultiTexCoord4ivARB - glMultiTexCoord4sARB - glMultiTexCoord4svARB - glLoadTransposeMatrixfARB - glLoadTransposeMatrixdARB - glMultTransposeMatrixfARB - glMultTransposeMatrixdARB - glSampleCoverageARB - glCompressedTexImage3DARB - glCompressedTexImage2DARB - glCompressedTexImage1DARB - glCompressedTexSubImage3DARB - glCompressedTexSubImage2DARB - glCompressedTexSubImage1DARB - glGetCompressedTexImageARB - glActiveTexture - glClientActiveTexture - glMultiTexCoord1d - glMultiTexCoord1dv - glMultiTexCoord1f - glMultiTexCoord1fv - glMultiTexCoord1i - glMultiTexCoord1iv - glMultiTexCoord1s - glMultiTexCoord1sv - glMultiTexCoord2d - glMultiTexCoord2dv - glMultiTexCoord2f - glMultiTexCoord2fv - glMultiTexCoord2i - glMultiTexCoord2iv - glMultiTexCoord2s - glMultiTexCoord2sv - glMultiTexCoord3d - glMultiTexCoord3dv - glMultiTexCoord3f - glMultiTexCoord3fv - glMultiTexCoord3i - glMultiTexCoord3iv - glMultiTexCoord3s - glMultiTexCoord3sv - glMultiTexCoord4d - glMultiTexCoord4dv - glMultiTexCoord4f - glMultiTexCoord4fv - glMultiTexCoord4i - glMultiTexCoord4iv - glMultiTexCoord4s - glMultiTexCoord4sv - glLoadTransposeMatrixf - glLoadTransposeMatrixd - glMultTransposeMatrixf - glMultTransposeMatrixd - glSampleCoverage - glCompressedTexImage3D - glCompressedTexImage2D - glCompressedTexImage1D - glCompressedTexSubImage3D - glCompressedTexSubImage2D - glCompressedTexSubImage1D - glGetCompressedTexImage - glBlendColorEXT - glPolygonOffsetEXT - glTexImage3DEXT - glTexSubImage3DEXT - glTexSubImage1DEXT - glTexSubImage2DEXT - glCopyTexImage1DEXT - glCopyTexImage2DEXT - glCopyTexSubImage1DEXT - glCopyTexSubImage2DEXT - glCopyTexSubImage3DEXT - glAreTexturesResidentEXT - glBindTextureEXT - glDeleteTexturesEXT - glGenTexturesEXT - glIsTextureEXT - glPrioritizeTexturesEXT - glArrayElementEXT - glColorPointerEXT - glDrawArraysEXT - glEdgeFlagPointerEXT - glGetPointervEXT - glIndexPointerEXT - glNormalPointerEXT - glTexCoordPointerEXT - glVertexPointerEXT - glBlendEquationEXT - glPointParameterfEXT - glPointParameterfvEXT - glPointParameterfARB - glPointParameterfvARB - glColorTableEXT - glGetColorTableEXT - glGetColorTableParameterivEXT - glGetColorTableParameterfvEXT - glLockArraysEXT - glUnlockArraysEXT - glDrawRangeElementsEXT - glSecondaryColor3bEXT - glSecondaryColor3bvEXT - glSecondaryColor3dEXT - glSecondaryColor3dvEXT - glSecondaryColor3fEXT - glSecondaryColor3fvEXT - glSecondaryColor3iEXT - glSecondaryColor3ivEXT - glSecondaryColor3sEXT - glSecondaryColor3svEXT - glSecondaryColor3ubEXT - glSecondaryColor3ubvEXT - glSecondaryColor3uiEXT - glSecondaryColor3uivEXT - glSecondaryColor3usEXT - glSecondaryColor3usvEXT - glSecondaryColorPointerEXT - glMultiDrawArraysEXT - glMultiDrawElementsEXT - glFogCoordfEXT - glFogCoordfvEXT - glFogCoorddEXT - glFogCoorddvEXT - glFogCoordPointerEXT - glBlendFuncSeparateEXT - glFlushVertexArrayRangeNV - glVertexArrayRangeNV - glCombinerParameterfvNV - glCombinerParameterfNV - glCombinerParameterivNV - glCombinerParameteriNV - glCombinerInputNV - glCombinerOutputNV - glFinalCombinerInputNV - glGetCombinerInputParameterfvNV - glGetCombinerInputParameterivNV - glGetCombinerOutputParameterfvNV - glGetCombinerOutputParameterivNV - glGetFinalCombinerInputParameterfvNV - glGetFinalCombinerInputParameterivNV - glResizeBuffersMESA - glWindowPos2dMESA - glWindowPos2dvMESA - glWindowPos2fMESA - glWindowPos2fvMESA - glWindowPos2iMESA - glWindowPos2ivMESA - glWindowPos2sMESA - glWindowPos2svMESA - glWindowPos3dMESA - glWindowPos3dvMESA - glWindowPos3fMESA - glWindowPos3fvMESA - glWindowPos3iMESA - glWindowPos3ivMESA - glWindowPos3sMESA - glWindowPos3svMESA - glWindowPos4dMESA - glWindowPos4dvMESA - glWindowPos4fMESA - glWindowPos4fvMESA - glWindowPos4iMESA - glWindowPos4ivMESA - glWindowPos4sMESA - glWindowPos4svMESA - glWindowPos2dARB - glWindowPos2fARB - glWindowPos2iARB - glWindowPos2sARB - glWindowPos2dvARB - glWindowPos2fvARB - glWindowPos2ivARB - glWindowPos2svARB - glWindowPos3dARB - glWindowPos3fARB - glWindowPos3iARB - glWindowPos3sARB - glWindowPos3dvARB - glWindowPos3fvARB - glWindowPos3ivARB - glWindowPos3svARB - glAreProgramsResidentNV - glBindProgramNV - glDeleteProgramsNV - glExecuteProgramNV - glGenProgramsNV - glGetProgramParameterdvNV - glGetProgramParameterfvNV - glGetProgramivNV - glGetProgramStringNV - glGetTrackMatrixivNV - glGetVertexAttribdvNV - glGetVertexAttribfvNV - glGetVertexAttribivNV - glGetVertexAttribPointervNV - glIsProgramNV - glLoadProgramNV - glProgramParameter4dNV - glProgramParameter4dvNV - glProgramParameter4fNV - glProgramParameter4fvNV - glProgramParameters4dvNV - glProgramParameters4fvNV - glRequestResidentProgramsNV - glTrackMatrixNV - glVertexAttribPointerNV - glVertexAttrib1dNV - glVertexAttrib1dvNV - glVertexAttrib1fNV - glVertexAttrib1fvNV - glVertexAttrib1sNV - glVertexAttrib1svNV - glVertexAttrib2dNV - glVertexAttrib2dvNV - glVertexAttrib2fNV - glVertexAttrib2fvNV - glVertexAttrib2sNV - glVertexAttrib2svNV - glVertexAttrib3dNV - glVertexAttrib3dvNV - glVertexAttrib3fNV - glVertexAttrib3fvNV - glVertexAttrib3sNV - glVertexAttrib3svNV - glVertexAttrib4dNV - glVertexAttrib4dvNV - glVertexAttrib4fNV - glVertexAttrib4fvNV - glVertexAttrib4sNV - glVertexAttrib4svNV - glVertexAttrib4ubNV - glVertexAttrib4ubvNV - glVertexAttribs1dvNV - glVertexAttribs1fvNV - glVertexAttribs1svNV - glVertexAttribs2dvNV - glVertexAttribs2fvNV - glVertexAttribs2svNV - glVertexAttribs3dvNV - glVertexAttribs3fvNV - glVertexAttribs3svNV - glVertexAttribs4dvNV - glVertexAttribs4fvNV - glVertexAttribs4svNV - glVertexAttribs4ubvNV - glPointParameteriNV - glPointParameterivNV - glFogCoordf - glFogCoordfv - glFogCoordd - glFogCoorddv - glFogCoordPointer - glMultiDrawArrays - glMultiDrawElements - glPointParameterf - glPointParameterfv - glPointParameteri - glPointParameteriv - glSecondaryColor3b - glSecondaryColor3bv - glSecondaryColor3d - glSecondaryColor3dv - glSecondaryColor3f - glSecondaryColor3fv - glSecondaryColor3i - glSecondaryColor3iv - glSecondaryColor3s - glSecondaryColor3sv - glSecondaryColor3ub - glSecondaryColor3ubv - glSecondaryColor3ui - glSecondaryColor3uiv - glSecondaryColor3us - glSecondaryColor3usv - glSecondaryColorPointer - glWindowPos2d - glWindowPos2dv - glWindowPos2f - glWindowPos2fv - glWindowPos2i - glWindowPos2iv - glWindowPos2s - glWindowPos2sv - glWindowPos3d - glWindowPos3dv - glWindowPos3f - glWindowPos3fv - glWindowPos3i - glWindowPos3iv - glWindowPos3s - glWindowPos3sv - glVertexAttrib1sARB - glVertexAttrib1fARB - glVertexAttrib1dARB - glVertexAttrib2sARB - glVertexAttrib2fARB - glVertexAttrib2dARB - glVertexAttrib3sARB - glVertexAttrib3fARB - glVertexAttrib3dARB - glVertexAttrib4sARB - glVertexAttrib4fARB - glVertexAttrib4dARB - glVertexAttrib4NubARB - glVertexAttrib1svARB - glVertexAttrib1fvARB - glVertexAttrib1dvARB - glVertexAttrib2svARB - glVertexAttrib2fvARB - glVertexAttrib2dvARB - glVertexAttrib3svARB - glVertexAttrib3fvARB - glVertexAttrib3dvARB - glVertexAttrib4bvARB - glVertexAttrib4svARB - glVertexAttrib4ivARB - glVertexAttrib4ubvARB - glVertexAttrib4usvARB - glVertexAttrib4uivARB - glVertexAttrib4fvARB - glVertexAttrib4dvARB - glVertexAttrib4NbvARB - glVertexAttrib4NsvARB - glVertexAttrib4NivARB - glVertexAttrib4NubvARB - glVertexAttrib4NusvARB - glVertexAttrib4NuivARB - glVertexAttribPointerARB - glEnableVertexAttribArrayARB - glDisableVertexAttribArrayARB - glProgramStringARB - glBindProgramARB - glDeleteProgramsARB - glGenProgramsARB - glIsProgramARB - glProgramEnvParameter4dARB - glProgramEnvParameter4dvARB - glProgramEnvParameter4fARB - glProgramEnvParameter4fvARB - glProgramLocalParameter4dARB - glProgramLocalParameter4dvARB - glProgramLocalParameter4fARB - glProgramLocalParameter4fvARB - glGetProgramEnvParameterdvARB - glGetProgramEnvParameterfvARB - glGetProgramLocalParameterdvARB - glGetProgramLocalParameterfvARB - glGetProgramivARB - glGetProgramStringARB - glGetVertexAttribdvARB - glGetVertexAttribfvARB - glGetVertexAttribivARB - glGetVertexAttribPointervARB - glProgramNamedParameter4fNV - glProgramNamedParameter4dNV - glProgramNamedParameter4fvNV - glProgramNamedParameter4dvNV - glGetProgramNamedParameterfvNV - glGetProgramNamedParameterdvNV - glBindBufferARB - glBufferDataARB - glBufferSubDataARB - glDeleteBuffersARB - glGenBuffersARB - glGetBufferParameterivARB - glGetBufferPointervARB - glGetBufferSubDataARB - glIsBufferARB - glMapBufferARB - glUnmapBufferARB - glGenQueriesARB - glDeleteQueriesARB - glIsQueryARB - glBeginQueryARB - glEndQueryARB - glGetQueryivARB - glGetQueryObjectivARB - glGetQueryObjectuivARB - glBindBuffer - glBufferData - glBufferSubData - glDeleteBuffers - glGenBuffers - glGetBufferParameteriv - glGetBufferPointerv - glGetBufferSubData - glIsBuffer - glMapBuffer - glUnmapBuffer - glGenQueries - glDeleteQueries - glIsQuery - glBeginQuery - glEndQuery - glGetQueryiv - glGetQueryObjectiv - glGetQueryObjectuiv -; -; WGL API - wglChoosePixelFormat - wglCopyContext - wglCreateContext - wglCreateLayerContext - wglDeleteContext - wglDescribeLayerPlane - wglDescribePixelFormat - wglGetCurrentContext - wglGetCurrentDC - wglGetLayerPaletteEntries - wglGetPixelFormat - wglGetProcAddress - wglMakeCurrent - wglRealizeLayerPalette - wglSetLayerPaletteEntries - wglSetPixelFormat - wglShareLists - wglSwapBuffers - wglSwapLayerBuffers - wglUseFontBitmapsA - wglUseFontBitmapsW - wglUseFontOutlinesA - wglUseFontOutlinesW - wglGetExtensionsStringARB -; -; ICD API - DrvCopyContext - DrvCreateContext - DrvCreateLayerContext - DrvDeleteContext - DrvDescribeLayerPlane - DrvDescribePixelFormat - DrvGetLayerPaletteEntries - DrvGetProcAddress - DrvRealizeLayerPalette - DrvReleaseContext - DrvSetCallbackProcs - DrvSetContext - DrvSetLayerPaletteEntries - DrvSetPixelFormat - DrvShareLists - DrvSwapBuffers - DrvSwapLayerBuffers - DrvValidateVersion diff --git a/src/mesa/state_tracker/wgl/stw_device.c b/src/mesa/state_tracker/wgl/stw_device.c deleted file mode 100644 index e2a17d83ac..0000000000 --- a/src/mesa/state_tracker/wgl/stw_device.c +++ /dev/null @@ -1,80 +0,0 @@ -/************************************************************************** - * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include <windows.h> - -#include "pipe/p_debug.h" - -#include "stw_device.h" -#include "stw_winsys.h" -#include "stw_pixelformat.h" - - -struct stw_device *stw_dev = NULL; - - -boolean -st_init(const struct stw_winsys *stw_winsys) -{ - static struct stw_device stw_dev_storage; - - assert(!stw_dev); - - stw_dev = &stw_dev_storage; - memset(stw_dev, 0, sizeof(*stw_dev)); - - stw_dev->stw_winsys = stw_winsys; - - stw_dev->screen = stw_winsys->create_screen(); - if(!stw_dev->screen) - goto error1; - - pixelformat_init(); - - return TRUE; - -error1: - stw_dev = NULL; - return FALSE; -} - - -void -st_cleanup(void) -{ - DHGLRC dhglrc; - - if(!stw_dev) - return; - - /* Ensure all contexts are destroyed */ - for (dhglrc = 1; dhglrc <= DRV_CONTEXT_MAX; dhglrc++) - if (stw_dev->ctx_array[dhglrc - 1].hglrc) - DrvDeleteContext( dhglrc ); - - stw_dev = NULL; -} diff --git a/src/mesa/state_tracker/wgl/stw_device.h b/src/mesa/state_tracker/wgl/stw_device.h deleted file mode 100644 index e2020bf055..0000000000 --- a/src/mesa/state_tracker/wgl/stw_device.h +++ /dev/null @@ -1,60 +0,0 @@ -/************************************************************************** - * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#ifndef ST_DEVICE_H_ -#define ST_DEVICE_H_ - - -#include "stw_icd.h" - -struct pipe_screen; - - -struct drv_context -{ - HGLRC hglrc; -}; - -#define DRV_CONTEXT_MAX 32 - - -struct stw_device -{ - const struct stw_winsys *stw_winsys; - - struct pipe_screen *screen; - - struct drv_context ctx_array[DRV_CONTEXT_MAX]; - - DHGLRC ctx_current; -}; - - -extern struct stw_device *stw_dev; - - -#endif /* ST_DEVICE_H_ */ diff --git a/src/mesa/state_tracker/wgl/stw_framebuffer.c b/src/mesa/state_tracker/wgl/stw_framebuffer.c deleted file mode 100644 index 1ecafa451e..0000000000 --- a/src/mesa/state_tracker/wgl/stw_framebuffer.c +++ /dev/null @@ -1,181 +0,0 @@ -/************************************************************************** - * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include <windows.h> - -#include "main/context.h" -#include "pipe/p_format.h" -#include "state_tracker/st_context.h" -#include "state_tracker/st_public.h" -#include "stw_framebuffer.h" - -void -framebuffer_resize( - struct stw_framebuffer *fb, - GLuint width, - GLuint height ) -{ - if (fb->hbmDIB == NULL || fb->stfb->Base.Width != width || fb->stfb->Base.Height != height) { - if (fb->hbmDIB) - DeleteObject( fb->hbmDIB ); - - fb->hbmDIB = CreateCompatibleBitmap( - fb->hDC, - width, - height ); - } - - st_resize_framebuffer( fb->stfb, width, height ); -} - -static struct stw_framebuffer *fb_head = NULL; - -static LRESULT CALLBACK -window_proc( - HWND hWnd, - UINT uMsg, - WPARAM wParam, - LPARAM lParam ) -{ - struct stw_framebuffer *fb; - - for (fb = fb_head; fb != NULL; fb = fb->next) - if (fb->hWnd == hWnd) - break; - assert( fb != NULL ); - - if (uMsg == WM_SIZE && wParam != SIZE_MINIMIZED) - framebuffer_resize( fb, LOWORD( lParam ), HIWORD( lParam ) ); - - return CallWindowProc( fb->WndProc, hWnd, uMsg, wParam, lParam ); -} - -/* Create a new framebuffer object which will correspond to the given HDC. - */ -struct stw_framebuffer * -framebuffer_create( - HDC hdc, - GLvisual *visual, - GLuint width, - GLuint height ) -{ - struct stw_framebuffer *fb; - enum pipe_format colorFormat, depthFormat, stencilFormat; - - fb = CALLOC_STRUCT( stw_framebuffer ); - if (fb == NULL) - return NULL; - - /* Determine PIPE_FORMATs for buffers. - */ - colorFormat = PIPE_FORMAT_A8R8G8B8_UNORM; - - if (visual->depthBits == 0) - depthFormat = PIPE_FORMAT_NONE; - else if (visual->depthBits <= 16) - depthFormat = PIPE_FORMAT_Z16_UNORM; - else if (visual->depthBits <= 24) - depthFormat = PIPE_FORMAT_S8Z24_UNORM; - else - depthFormat = PIPE_FORMAT_Z32_UNORM; - - if (visual->stencilBits == 8) { - if (depthFormat == PIPE_FORMAT_S8Z24_UNORM) - stencilFormat = depthFormat; - else - stencilFormat = PIPE_FORMAT_S8_UNORM; - } - else { - stencilFormat = PIPE_FORMAT_NONE; - } - - fb->stfb = st_create_framebuffer( - visual, - colorFormat, - depthFormat, - stencilFormat, - width, - height, - (void *) fb ); - - fb->cColorBits = GetDeviceCaps( hdc, BITSPIXEL ); - fb->hDC = hdc; - - /* Subclass a window associated with the device context. - */ - fb->hWnd = WindowFromDC( hdc ); - if (fb->hWnd != NULL) { - fb->WndProc = (WNDPROC) SetWindowLong( - fb->hWnd, - GWL_WNDPROC, - (LONG) window_proc ); - } - - fb->next = fb_head; - fb_head = fb; - return fb; -} - -void -framebuffer_destroy( - struct stw_framebuffer *fb ) -{ - struct stw_framebuffer **link = &fb_head; - struct stw_framebuffer *pfb = fb_head; - - while (pfb != NULL) { - if (pfb == fb) { - if (fb->hWnd != NULL) { - SetWindowLong( - fb->hWnd, - GWL_WNDPROC, - (LONG) fb->WndProc ); - } - - *link = fb->next; - FREE( fb ); - return; - } - - link = &pfb->next; - pfb = pfb->next; - } -} - -/* Given an hdc, return the corresponding wgl_context. - */ -struct stw_framebuffer * -framebuffer_from_hdc( - HDC hdc ) -{ - struct stw_framebuffer *fb; - - for (fb = fb_head; fb != NULL; fb = fb->next) - if (fb->hDC == hdc) - return fb; - return NULL; -} diff --git a/src/mesa/state_tracker/wgl/stw_framebuffer.h b/src/mesa/state_tracker/wgl/stw_framebuffer.h deleted file mode 100644 index 2e16e421f2..0000000000 --- a/src/mesa/state_tracker/wgl/stw_framebuffer.h +++ /dev/null @@ -1,71 +0,0 @@ -/************************************************************************** - * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#ifndef STW_FRAMEBUFFER_H -#define STW_FRAMEBUFFER_H - -#include "main/mtypes.h" - -/* Windows framebuffer, derived from gl_framebuffer. - */ -struct stw_framebuffer -{ - struct st_framebuffer *stfb; - HDC hDC; - int pixelformat; - BYTE cColorBits; - HDC dib_hDC; - HBITMAP hbmDIB; - HBITMAP hOldBitmap; - PBYTE pbPixels; - HWND hWnd; - WNDPROC WndProc; - struct stw_framebuffer *next; -}; - -struct stw_framebuffer * -framebuffer_create( - HDC hdc, - GLvisual *visual, - GLuint width, - GLuint height ); - -void -framebuffer_destroy( - struct stw_framebuffer *fb ); - -void -framebuffer_resize( - struct stw_framebuffer *fb, - GLuint width, - GLuint height ); - -struct stw_framebuffer * -framebuffer_from_hdc( - HDC hdc ); - -#endif /* STW_FRAMEBUFFER_H */ diff --git a/src/mesa/state_tracker/wgl/stw_icd.c b/src/mesa/state_tracker/wgl/stw_icd.c deleted file mode 100644 index 1dddc24209..0000000000 --- a/src/mesa/state_tracker/wgl/stw_icd.c +++ /dev/null @@ -1,637 +0,0 @@ -/************************************************************************** - * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include <windows.h> -#include <stdio.h> - -#include "GL/gl.h" - -#include "pipe/p_debug.h" - -#include "stw_device.h" -#include "stw_icd.h" -#include "stw_wgl.h" - - -static HGLRC -_drv_lookup_hglrc( DHGLRC dhglrc ) -{ - if (dhglrc == 0 || dhglrc >= DRV_CONTEXT_MAX) - return NULL; - return stw_dev->ctx_array[dhglrc - 1].hglrc; -} - -BOOL APIENTRY -DrvCopyContext( - DHGLRC dhrcSource, - DHGLRC dhrcDest, - UINT fuMask ) -{ - debug_printf( "%s\n", __FUNCTION__ ); - - return FALSE; -} - -DHGLRC APIENTRY -DrvCreateLayerContext( - HDC hdc, - INT iLayerPlane ) -{ - DHGLRC dhglrc = 0; - - if (iLayerPlane == 0) { - DWORD i; - - for (i = 0; i < DRV_CONTEXT_MAX; i++) { - if (stw_dev->ctx_array[i].hglrc == NULL) - break; - } - - if (i < DRV_CONTEXT_MAX) { - stw_dev->ctx_array[i].hglrc = wglCreateContext( hdc ); - if (stw_dev->ctx_array[i].hglrc != NULL) - dhglrc = i + 1; - } - } - - debug_printf( "%s( 0x%p, %d ) = %u\n", __FUNCTION__, hdc, iLayerPlane, dhglrc ); - - return dhglrc; -} - -DHGLRC APIENTRY -DrvCreateContext( - HDC hdc ) -{ - return DrvCreateLayerContext( hdc, 0 ); -} - -BOOL APIENTRY -DrvDeleteContext( - DHGLRC dhglrc ) -{ - HGLRC hglrc = _drv_lookup_hglrc( dhglrc ); - BOOL success = FALSE; - - if (hglrc != NULL) { - success = wglDeleteContext( hglrc ); - if (success) - stw_dev->ctx_array[dhglrc - 1].hglrc = NULL; - } - - debug_printf( "%s( %u ) = %s\n", __FUNCTION__, dhglrc, success ? "TRUE" : "FALSE" ); - - return success; -} - -BOOL APIENTRY -DrvDescribeLayerPlane( - HDC hdc, - INT iPixelFormat, - INT iLayerPlane, - UINT nBytes, - LPLAYERPLANEDESCRIPTOR plpd ) -{ - debug_printf( "%s\n", __FUNCTION__ ); - - return FALSE; -} - -LONG APIENTRY -DrvDescribePixelFormat( - HDC hdc, - INT iPixelFormat, - ULONG cjpfd, - PIXELFORMATDESCRIPTOR *ppfd ) -{ - LONG r; - - r = wglDescribePixelFormat( hdc, iPixelFormat, cjpfd, ppfd ); - - debug_printf( "%s( 0x%p, %d, %u, 0x%p ) = %d\n", __FUNCTION__, hdc, iPixelFormat, cjpfd, ppfd, r ); - - return r; -} - -int APIENTRY -DrvGetLayerPaletteEntries( - HDC hdc, - INT iLayerPlane, - INT iStart, - INT cEntries, - COLORREF *pcr ) -{ - debug_printf( "%s\n", __FUNCTION__ ); - - return 0; -} - -PROC APIENTRY -DrvGetProcAddress( - LPCSTR lpszProc ) -{ - PROC r; - - r = wglGetProcAddress( lpszProc ); - - debug_printf( "%s( \", __FUNCTION__%s\" ) = 0x%p\n", lpszProc, r ); - - return r; -} - -BOOL APIENTRY -DrvRealizeLayerPalette( - HDC hdc, - INT iLayerPlane, - BOOL bRealize ) -{ - debug_printf( "%s\n", __FUNCTION__ ); - - return FALSE; -} - -BOOL APIENTRY -DrvReleaseContext( - DHGLRC dhglrc ) -{ - BOOL success = FALSE; - - if (dhglrc == stw_dev->ctx_current) { - HGLRC hglrc = _drv_lookup_hglrc( dhglrc ); - - if (hglrc != NULL) { - success = wglMakeCurrent( NULL, NULL ); - if (success) - stw_dev->ctx_current = 0; - } - } - - debug_printf( "%s( %u ) = %s\n", __FUNCTION__, dhglrc, success ? "TRUE" : "FALSE" ); - - return success; -} - -void APIENTRY -DrvSetCallbackProcs( - INT nProcs, - PROC *pProcs ) -{ - debug_printf( "%s( %d, 0x%p )\n", __FUNCTION__, nProcs, pProcs ); - - return; -} - -#define GPA_GL( NAME ) disp->NAME = gl##NAME - -static GLCLTPROCTABLE cpt; - -PGLCLTPROCTABLE APIENTRY -DrvSetContext( - HDC hdc, - DHGLRC dhglrc, - PFN_SETPROCTABLE pfnSetProcTable ) -{ - HGLRC hglrc = _drv_lookup_hglrc( dhglrc ); - GLDISPATCHTABLE *disp = &cpt.glDispatchTable; - - debug_printf( "%s( 0x%p, %u, 0x%p )\n", __FUNCTION__, hdc, dhglrc, pfnSetProcTable ); - - if (hglrc == NULL) - return NULL; - - if (!wglMakeCurrent( hdc, hglrc )) - return NULL; - - memset( &cpt, 0, sizeof( cpt ) ); - cpt.cEntries = OPENGL_VERSION_110_ENTRIES; - - GPA_GL( NewList ); - GPA_GL( EndList ); - GPA_GL( CallList ); - GPA_GL( CallLists ); - GPA_GL( DeleteLists ); - GPA_GL( GenLists ); - GPA_GL( ListBase ); - GPA_GL( Begin ); - GPA_GL( Bitmap ); - GPA_GL( Color3b ); - GPA_GL( Color3bv ); - GPA_GL( Color3d ); - GPA_GL( Color3dv ); - GPA_GL( Color3f ); - GPA_GL( Color3fv ); - GPA_GL( Color3i ); - GPA_GL( Color3iv ); - GPA_GL( Color3s ); - GPA_GL( Color3sv ); - GPA_GL( Color3ub ); - GPA_GL( Color3ubv ); - GPA_GL( Color3ui ); - GPA_GL( Color3uiv ); - GPA_GL( Color3us ); - GPA_GL( Color3usv ); - GPA_GL( Color4b ); - GPA_GL( Color4bv ); - GPA_GL( Color4d ); - GPA_GL( Color4dv ); - GPA_GL( Color4f ); - GPA_GL( Color4fv ); - GPA_GL( Color4i ); - GPA_GL( Color4iv ); - GPA_GL( Color4s ); - GPA_GL( Color4sv ); - GPA_GL( Color4ub ); - GPA_GL( Color4ubv ); - GPA_GL( Color4ui ); - GPA_GL( Color4uiv ); - GPA_GL( Color4us ); - GPA_GL( Color4usv ); - GPA_GL( EdgeFlag ); - GPA_GL( EdgeFlagv ); - GPA_GL( End ); - GPA_GL( Indexd ); - GPA_GL( Indexdv ); - GPA_GL( Indexf ); - GPA_GL( Indexfv ); - GPA_GL( Indexi ); - GPA_GL( Indexiv ); - GPA_GL( Indexs ); - GPA_GL( Indexsv ); - GPA_GL( Normal3b ); - GPA_GL( Normal3bv ); - GPA_GL( Normal3d ); - GPA_GL( Normal3dv ); - GPA_GL( Normal3f ); - GPA_GL( Normal3fv ); - GPA_GL( Normal3i ); - GPA_GL( Normal3iv ); - GPA_GL( Normal3s ); - GPA_GL( Normal3sv ); - GPA_GL( RasterPos2d ); - GPA_GL( RasterPos2dv ); - GPA_GL( RasterPos2f ); - GPA_GL( RasterPos2fv ); - GPA_GL( RasterPos2i ); - GPA_GL( RasterPos2iv ); - GPA_GL( RasterPos2s ); - GPA_GL( RasterPos2sv ); - GPA_GL( RasterPos3d ); - GPA_GL( RasterPos3dv ); - GPA_GL( RasterPos3f ); - GPA_GL( RasterPos3fv ); - GPA_GL( RasterPos3i ); - GPA_GL( RasterPos3iv ); - GPA_GL( RasterPos3s ); - GPA_GL( RasterPos3sv ); - GPA_GL( RasterPos4d ); - GPA_GL( RasterPos4dv ); - GPA_GL( RasterPos4f ); - GPA_GL( RasterPos4fv ); - GPA_GL( RasterPos4i ); - GPA_GL( RasterPos4iv ); - GPA_GL( RasterPos4s ); - GPA_GL( RasterPos4sv ); - GPA_GL( Rectd ); - GPA_GL( Rectdv ); - GPA_GL( Rectf ); - GPA_GL( Rectfv ); - GPA_GL( Recti ); - GPA_GL( Rectiv ); - GPA_GL( Rects ); - GPA_GL( Rectsv ); - GPA_GL( TexCoord1d ); - GPA_GL( TexCoord1dv ); - GPA_GL( TexCoord1f ); - GPA_GL( TexCoord1fv ); - GPA_GL( TexCoord1i ); - GPA_GL( TexCoord1iv ); - GPA_GL( TexCoord1s ); - GPA_GL( TexCoord1sv ); - GPA_GL( TexCoord2d ); - GPA_GL( TexCoord2dv ); - GPA_GL( TexCoord2f ); - GPA_GL( TexCoord2fv ); - GPA_GL( TexCoord2i ); - GPA_GL( TexCoord2iv ); - GPA_GL( TexCoord2s ); - GPA_GL( TexCoord2sv ); - GPA_GL( TexCoord3d ); - GPA_GL( TexCoord3dv ); - GPA_GL( TexCoord3f ); - GPA_GL( TexCoord3fv ); - GPA_GL( TexCoord3i ); - GPA_GL( TexCoord3iv ); - GPA_GL( TexCoord3s ); - GPA_GL( TexCoord3sv ); - GPA_GL( TexCoord4d ); - GPA_GL( TexCoord4dv ); - GPA_GL( TexCoord4f ); - GPA_GL( TexCoord4fv ); - GPA_GL( TexCoord4i ); - GPA_GL( TexCoord4iv ); - GPA_GL( TexCoord4s ); - GPA_GL( TexCoord4sv ); - GPA_GL( Vertex2d ); - GPA_GL( Vertex2dv ); - GPA_GL( Vertex2f ); - GPA_GL( Vertex2fv ); - GPA_GL( Vertex2i ); - GPA_GL( Vertex2iv ); - GPA_GL( Vertex2s ); - GPA_GL( Vertex2sv ); - GPA_GL( Vertex3d ); - GPA_GL( Vertex3dv ); - GPA_GL( Vertex3f ); - GPA_GL( Vertex3fv ); - GPA_GL( Vertex3i ); - GPA_GL( Vertex3iv ); - GPA_GL( Vertex3s ); - GPA_GL( Vertex3sv ); - GPA_GL( Vertex4d ); - GPA_GL( Vertex4dv ); - GPA_GL( Vertex4f ); - GPA_GL( Vertex4fv ); - GPA_GL( Vertex4i ); - GPA_GL( Vertex4iv ); - GPA_GL( Vertex4s ); - GPA_GL( Vertex4sv ); - GPA_GL( ClipPlane ); - GPA_GL( ColorMaterial ); - GPA_GL( CullFace ); - GPA_GL( Fogf ); - GPA_GL( Fogfv ); - GPA_GL( Fogi ); - GPA_GL( Fogiv ); - GPA_GL( FrontFace ); - GPA_GL( Hint ); - GPA_GL( Lightf ); - GPA_GL( Lightfv ); - GPA_GL( Lighti ); - GPA_GL( Lightiv ); - GPA_GL( LightModelf ); - GPA_GL( LightModelfv ); - GPA_GL( LightModeli ); - GPA_GL( LightModeliv ); - GPA_GL( LineStipple ); - GPA_GL( LineWidth ); - GPA_GL( Materialf ); - GPA_GL( Materialfv ); - GPA_GL( Materiali ); - GPA_GL( Materialiv ); - GPA_GL( PointSize ); - GPA_GL( PolygonMode ); - GPA_GL( PolygonStipple ); - GPA_GL( Scissor ); - GPA_GL( ShadeModel ); - GPA_GL( TexParameterf ); - GPA_GL( TexParameterfv ); - GPA_GL( TexParameteri ); - GPA_GL( TexParameteriv ); - GPA_GL( TexImage1D ); - GPA_GL( TexImage2D ); - GPA_GL( TexEnvf ); - GPA_GL( TexEnvfv ); - GPA_GL( TexEnvi ); - GPA_GL( TexEnviv ); - GPA_GL( TexGend ); - GPA_GL( TexGendv ); - GPA_GL( TexGenf ); - GPA_GL( TexGenfv ); - GPA_GL( TexGeni ); - GPA_GL( TexGeniv ); - GPA_GL( FeedbackBuffer ); - GPA_GL( SelectBuffer ); - GPA_GL( RenderMode ); - GPA_GL( InitNames ); - GPA_GL( LoadName ); - GPA_GL( PassThrough ); - GPA_GL( PopName ); - GPA_GL( PushName ); - GPA_GL( DrawBuffer ); - GPA_GL( Clear ); - GPA_GL( ClearAccum ); - GPA_GL( ClearIndex ); - GPA_GL( ClearColor ); - GPA_GL( ClearStencil ); - GPA_GL( ClearDepth ); - GPA_GL( StencilMask ); - GPA_GL( ColorMask ); - GPA_GL( DepthMask ); - GPA_GL( IndexMask ); - GPA_GL( Accum ); - GPA_GL( Disable ); - GPA_GL( Enable ); - GPA_GL( Finish ); - GPA_GL( Flush ); - GPA_GL( PopAttrib ); - GPA_GL( PushAttrib ); - GPA_GL( Map1d ); - GPA_GL( Map1f ); - GPA_GL( Map2d ); - GPA_GL( Map2f ); - GPA_GL( MapGrid1d ); - GPA_GL( MapGrid1f ); - GPA_GL( MapGrid2d ); - GPA_GL( MapGrid2f ); - GPA_GL( EvalCoord1d ); - GPA_GL( EvalCoord1dv ); - GPA_GL( EvalCoord1f ); - GPA_GL( EvalCoord1fv ); - GPA_GL( EvalCoord2d ); - GPA_GL( EvalCoord2dv ); - GPA_GL( EvalCoord2f ); - GPA_GL( EvalCoord2fv ); - GPA_GL( EvalMesh1 ); - GPA_GL( EvalPoint1 ); - GPA_GL( EvalMesh2 ); - GPA_GL( EvalPoint2 ); - GPA_GL( AlphaFunc ); - GPA_GL( BlendFunc ); - GPA_GL( LogicOp ); - GPA_GL( StencilFunc ); - GPA_GL( StencilOp ); - GPA_GL( DepthFunc ); - GPA_GL( PixelZoom ); - GPA_GL( PixelTransferf ); - GPA_GL( PixelTransferi ); - GPA_GL( PixelStoref ); - GPA_GL( PixelStorei ); - GPA_GL( PixelMapfv ); - GPA_GL( PixelMapuiv ); - GPA_GL( PixelMapusv ); - GPA_GL( ReadBuffer ); - GPA_GL( CopyPixels ); - GPA_GL( ReadPixels ); - GPA_GL( DrawPixels ); - GPA_GL( GetBooleanv ); - GPA_GL( GetClipPlane ); - GPA_GL( GetDoublev ); - GPA_GL( GetError ); - GPA_GL( GetFloatv ); - GPA_GL( GetIntegerv ); - GPA_GL( GetLightfv ); - GPA_GL( GetLightiv ); - GPA_GL( GetMapdv ); - GPA_GL( GetMapfv ); - GPA_GL( GetMapiv ); - GPA_GL( GetMaterialfv ); - GPA_GL( GetMaterialiv ); - GPA_GL( GetPixelMapfv ); - GPA_GL( GetPixelMapuiv ); - GPA_GL( GetPixelMapusv ); - GPA_GL( GetPolygonStipple ); - GPA_GL( GetString ); - GPA_GL( GetTexEnvfv ); - GPA_GL( GetTexEnviv ); - GPA_GL( GetTexGendv ); - GPA_GL( GetTexGenfv ); - GPA_GL( GetTexGeniv ); - GPA_GL( GetTexImage ); - GPA_GL( GetTexParameterfv ); - GPA_GL( GetTexParameteriv ); - GPA_GL( GetTexLevelParameterfv ); - GPA_GL( GetTexLevelParameteriv ); - GPA_GL( IsEnabled ); - GPA_GL( IsList ); - GPA_GL( DepthRange ); - GPA_GL( Frustum ); - GPA_GL( LoadIdentity ); - GPA_GL( LoadMatrixf ); - GPA_GL( LoadMatrixd ); - GPA_GL( MatrixMode ); - GPA_GL( MultMatrixf ); - GPA_GL( MultMatrixd ); - GPA_GL( Ortho ); - GPA_GL( PopMatrix ); - GPA_GL( PushMatrix ); - GPA_GL( Rotated ); - GPA_GL( Rotatef ); - GPA_GL( Scaled ); - GPA_GL( Scalef ); - GPA_GL( Translated ); - GPA_GL( Translatef ); - GPA_GL( Viewport ); - GPA_GL( ArrayElement ); - GPA_GL( BindTexture ); - GPA_GL( ColorPointer ); - GPA_GL( DisableClientState ); - GPA_GL( DrawArrays ); - GPA_GL( DrawElements ); - GPA_GL( EdgeFlagPointer ); - GPA_GL( EnableClientState ); - GPA_GL( IndexPointer ); - GPA_GL( Indexub ); - GPA_GL( Indexubv ); - GPA_GL( InterleavedArrays ); - GPA_GL( NormalPointer ); - GPA_GL( PolygonOffset ); - GPA_GL( TexCoordPointer ); - GPA_GL( VertexPointer ); - GPA_GL( AreTexturesResident ); - GPA_GL( CopyTexImage1D ); - GPA_GL( CopyTexImage2D ); - GPA_GL( CopyTexSubImage1D ); - GPA_GL( CopyTexSubImage2D ); - GPA_GL( DeleteTextures ); - GPA_GL( GenTextures ); - GPA_GL( GetPointerv ); - GPA_GL( IsTexture ); - GPA_GL( PrioritizeTextures ); - GPA_GL( TexSubImage1D ); - GPA_GL( TexSubImage2D ); - GPA_GL( PopClientAttrib ); - GPA_GL( PushClientAttrib ); - - return &cpt; -} - -int APIENTRY -DrvSetLayerPaletteEntries( - HDC hdc, - INT iLayerPlane, - INT iStart, - INT cEntries, - CONST COLORREF *pcr ) -{ - debug_printf( "%s\n", __FUNCTION__ ); - - return 0; -} - -BOOL APIENTRY -DrvSetPixelFormat( - HDC hdc, - LONG iPixelFormat ) -{ - PIXELFORMATDESCRIPTOR pfd; - BOOL r; - - wglDescribePixelFormat( hdc, iPixelFormat, sizeof( pfd ), &pfd ); - r = wglSetPixelFormat( hdc, iPixelFormat, &pfd ); - - debug_printf( "%s( 0x%p, %d ) = %s\n", __FUNCTION__, hdc, iPixelFormat, r ? "TRUE" : "FALSE" ); - - return r; -} - -BOOL APIENTRY -DrvShareLists( - DHGLRC dhglrc1, - DHGLRC dhglrc2 ) -{ - debug_printf( "%s\n", __FUNCTION__ ); - - return FALSE; -} - -BOOL APIENTRY -DrvSwapBuffers( - HDC hdc ) -{ - debug_printf( "%s( 0x%p )\n", __FUNCTION__, hdc ); - - return wglSwapBuffers( hdc ); -} - -BOOL APIENTRY -DrvSwapLayerBuffers( - HDC hdc, - UINT fuPlanes ) -{ - debug_printf( "%s\n", __FUNCTION__ ); - - return FALSE; -} - -BOOL APIENTRY -DrvValidateVersion( - ULONG ulVersion ) -{ - debug_printf( "%s( %u )\n", __FUNCTION__, ulVersion ); - - return ulVersion == 1; -} diff --git a/src/mesa/state_tracker/wgl/stw_icd.h b/src/mesa/state_tracker/wgl/stw_icd.h deleted file mode 100644 index 8e676fb5b7..0000000000 --- a/src/mesa/state_tracker/wgl/stw_icd.h +++ /dev/null @@ -1,489 +0,0 @@ -/************************************************************************** - * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#ifndef DRV_H -#define DRV_H - - -#include <windows.h> - -#include "GL/gl.h" - - -typedef ULONG DHGLRC; - -#define OPENGL_VERSION_110_ENTRIES 336 - -struct __GLdispatchTableRec -{ - void (GLAPIENTRY * NewList)(GLuint, GLenum); - void (GLAPIENTRY * EndList)(void); - void (GLAPIENTRY * CallList)(GLuint); - void (GLAPIENTRY * CallLists)(GLsizei, GLenum, const GLvoid *); - void (GLAPIENTRY * DeleteLists)(GLuint, GLsizei); - GLuint (GLAPIENTRY * GenLists)(GLsizei); - void (GLAPIENTRY * ListBase)(GLuint); - void (GLAPIENTRY * Begin)(GLenum); - void (GLAPIENTRY * Bitmap)(GLsizei, GLsizei, GLfloat, GLfloat, GLfloat, GLfloat, const GLubyte *); - void (GLAPIENTRY * Color3b)(GLbyte, GLbyte, GLbyte); - void (GLAPIENTRY * Color3bv)(const GLbyte *); - void (GLAPIENTRY * Color3d)(GLdouble, GLdouble, GLdouble); - void (GLAPIENTRY * Color3dv)(const GLdouble *); - void (GLAPIENTRY * Color3f)(GLfloat, GLfloat, GLfloat); - void (GLAPIENTRY * Color3fv)(const GLfloat *); - void (GLAPIENTRY * Color3i)(GLint, GLint, GLint); - void (GLAPIENTRY * Color3iv)(const GLint *); - void (GLAPIENTRY * Color3s)(GLshort, GLshort, GLshort); - void (GLAPIENTRY * Color3sv)(const GLshort *); - void (GLAPIENTRY * Color3ub)(GLubyte, GLubyte, GLubyte); - void (GLAPIENTRY * Color3ubv)(const GLubyte *); - void (GLAPIENTRY * Color3ui)(GLuint, GLuint, GLuint); - void (GLAPIENTRY * Color3uiv)(const GLuint *); - void (GLAPIENTRY * Color3us)(GLushort, GLushort, GLushort); - void (GLAPIENTRY * Color3usv)(const GLushort *); - void (GLAPIENTRY * Color4b)(GLbyte, GLbyte, GLbyte, GLbyte); - void (GLAPIENTRY * Color4bv)(const GLbyte *); - void (GLAPIENTRY * Color4d)(GLdouble, GLdouble, GLdouble, GLdouble); - void (GLAPIENTRY * Color4dv)(const GLdouble *); - void (GLAPIENTRY * Color4f)(GLfloat, GLfloat, GLfloat, GLfloat); - void (GLAPIENTRY * Color4fv)(const GLfloat *); - void (GLAPIENTRY * Color4i)(GLint, GLint, GLint, GLint); - void (GLAPIENTRY * Color4iv)(const GLint *); - void (GLAPIENTRY * Color4s)(GLshort, GLshort, GLshort, GLshort); - void (GLAPIENTRY * Color4sv)(const GLshort *); - void (GLAPIENTRY * Color4ub)(GLubyte, GLubyte, GLubyte, GLubyte); - void (GLAPIENTRY * Color4ubv)(const GLubyte *); - void (GLAPIENTRY * Color4ui)(GLuint, GLuint, GLuint, GLuint); - void (GLAPIENTRY * Color4uiv)(const GLuint *); - void (GLAPIENTRY * Color4us)(GLushort, GLushort, GLushort, GLushort); - void (GLAPIENTRY * Color4usv)(const GLushort *); - void (GLAPIENTRY * EdgeFlag)(GLboolean); - void (GLAPIENTRY * EdgeFlagv)(const GLboolean *); - void (GLAPIENTRY * End)(void); - void (GLAPIENTRY * Indexd)(GLdouble); - void (GLAPIENTRY * Indexdv)(const GLdouble *); - void (GLAPIENTRY * Indexf)(GLfloat); - void (GLAPIENTRY * Indexfv)(const GLfloat *); - void (GLAPIENTRY * Indexi)(GLint); - void (GLAPIENTRY * Indexiv)(const GLint *); - void (GLAPIENTRY * Indexs)(GLshort); - void (GLAPIENTRY * Indexsv)(const GLshort *); - void (GLAPIENTRY * Normal3b)(GLbyte, GLbyte, GLbyte); - void (GLAPIENTRY * Normal3bv)(const GLbyte *); - void (GLAPIENTRY * Normal3d)(GLdouble, GLdouble, GLdouble); - void (GLAPIENTRY * Normal3dv)(const GLdouble *); - void (GLAPIENTRY * Normal3f)(GLfloat, GLfloat, GLfloat); - void (GLAPIENTRY * Normal3fv)(const GLfloat *); - void (GLAPIENTRY * Normal3i)(GLint, GLint, GLint); - void (GLAPIENTRY * Normal3iv)(const GLint *); - void (GLAPIENTRY * Normal3s)(GLshort, GLshort, GLshort); - void (GLAPIENTRY * Normal3sv)(const GLshort *); - void (GLAPIENTRY * RasterPos2d)(GLdouble, GLdouble); - void (GLAPIENTRY * RasterPos2dv)(const GLdouble *); - void (GLAPIENTRY * RasterPos2f)(GLfloat, GLfloat); - void (GLAPIENTRY * RasterPos2fv)(const GLfloat *); - void (GLAPIENTRY * RasterPos2i)(GLint, GLint); - void (GLAPIENTRY * RasterPos2iv)(const GLint *); - void (GLAPIENTRY * RasterPos2s)(GLshort, GLshort); - void (GLAPIENTRY * RasterPos2sv)(const GLshort *); - void (GLAPIENTRY * RasterPos3d)(GLdouble, GLdouble, GLdouble); - void (GLAPIENTRY * RasterPos3dv)(const GLdouble *); - void (GLAPIENTRY * RasterPos3f)(GLfloat, GLfloat, GLfloat); - void (GLAPIENTRY * RasterPos3fv)(const GLfloat *); - void (GLAPIENTRY * RasterPos3i)(GLint, GLint, GLint); - void (GLAPIENTRY * RasterPos3iv)(const GLint *); - void (GLAPIENTRY * RasterPos3s)(GLshort, GLshort, GLshort); - void (GLAPIENTRY * RasterPos3sv)(const GLshort *); - void (GLAPIENTRY * RasterPos4d)(GLdouble, GLdouble, GLdouble, GLdouble); - void (GLAPIENTRY * RasterPos4dv)(const GLdouble *); - void (GLAPIENTRY * RasterPos4f)(GLfloat, GLfloat, GLfloat, GLfloat); - void (GLAPIENTRY * RasterPos4fv)(const GLfloat *); - void (GLAPIENTRY * RasterPos4i)(GLint, GLint, GLint, GLint); - void (GLAPIENTRY * RasterPos4iv)(const GLint *); - void (GLAPIENTRY * RasterPos4s)(GLshort, GLshort, GLshort, GLshort); - void (GLAPIENTRY * RasterPos4sv)(const GLshort *); - void (GLAPIENTRY * Rectd)(GLdouble, GLdouble, GLdouble, GLdouble); - void (GLAPIENTRY * Rectdv)(const GLdouble *, const GLdouble *); - void (GLAPIENTRY * Rectf)(GLfloat, GLfloat, GLfloat, GLfloat); - void (GLAPIENTRY * Rectfv)(const GLfloat *, const GLfloat *); - void (GLAPIENTRY * Recti)(GLint, GLint, GLint, GLint); - void (GLAPIENTRY * Rectiv)(const GLint *, const GLint *); - void (GLAPIENTRY * Rects)(GLshort, GLshort, GLshort, GLshort); - void (GLAPIENTRY * Rectsv)(const GLshort *, const GLshort *); - void (GLAPIENTRY * TexCoord1d)(GLdouble); - void (GLAPIENTRY * TexCoord1dv)(const GLdouble *); - void (GLAPIENTRY * TexCoord1f)(GLfloat); - void (GLAPIENTRY * TexCoord1fv)(const GLfloat *); - void (GLAPIENTRY * TexCoord1i)(GLint); - void (GLAPIENTRY * TexCoord1iv)(const GLint *); - void (GLAPIENTRY * TexCoord1s)(GLshort); - void (GLAPIENTRY * TexCoord1sv)(const GLshort *); - void (GLAPIENTRY * TexCoord2d)(GLdouble, GLdouble); - void (GLAPIENTRY * TexCoord2dv)(const GLdouble *); - void (GLAPIENTRY * TexCoord2f)(GLfloat, GLfloat); - void (GLAPIENTRY * TexCoord2fv)(const GLfloat *); - void (GLAPIENTRY * TexCoord2i)(GLint, GLint); - void (GLAPIENTRY * TexCoord2iv)(const GLint *); - void (GLAPIENTRY * TexCoord2s)(GLshort, GLshort); - void (GLAPIENTRY * TexCoord2sv)(const GLshort *); - void (GLAPIENTRY * TexCoord3d)(GLdouble, GLdouble, GLdouble); - void (GLAPIENTRY * TexCoord3dv)(const GLdouble *); - void (GLAPIENTRY * TexCoord3f)(GLfloat, GLfloat, GLfloat); - void (GLAPIENTRY * TexCoord3fv)(const GLfloat *); - void (GLAPIENTRY * TexCoord3i)(GLint, GLint, GLint); - void (GLAPIENTRY * TexCoord3iv)(const GLint *); - void (GLAPIENTRY * TexCoord3s)(GLshort, GLshort, GLshort); - void (GLAPIENTRY * TexCoord3sv)(const GLshort *); - void (GLAPIENTRY * TexCoord4d)(GLdouble, GLdouble, GLdouble, GLdouble); - void (GLAPIENTRY * TexCoord4dv)(const GLdouble *); - void (GLAPIENTRY * TexCoord4f)(GLfloat, GLfloat, GLfloat, GLfloat); - void (GLAPIENTRY * TexCoord4fv)(const GLfloat *); - void (GLAPIENTRY * TexCoord4i)(GLint, GLint, GLint, GLint); - void (GLAPIENTRY * TexCoord4iv)(const GLint *); - void (GLAPIENTRY * TexCoord4s)(GLshort, GLshort, GLshort, GLshort); - void (GLAPIENTRY * TexCoord4sv)(const GLshort *); - void (GLAPIENTRY * Vertex2d)(GLdouble, GLdouble); - void (GLAPIENTRY * Vertex2dv)(const GLdouble *); - void (GLAPIENTRY * Vertex2f)(GLfloat, GLfloat); - void (GLAPIENTRY * Vertex2fv)(const GLfloat *); - void (GLAPIENTRY * Vertex2i)(GLint, GLint); - void (GLAPIENTRY * Vertex2iv)(const GLint *); - void (GLAPIENTRY * Vertex2s)(GLshort, GLshort); - void (GLAPIENTRY * Vertex2sv)(const GLshort *); - void (GLAPIENTRY * Vertex3d)(GLdouble, GLdouble, GLdouble); - void (GLAPIENTRY * Vertex3dv)(const GLdouble *); - void (GLAPIENTRY * Vertex3f)(GLfloat, GLfloat, GLfloat); - void (GLAPIENTRY * Vertex3fv)(const GLfloat *); - void (GLAPIENTRY * Vertex3i)(GLint, GLint, GLint); - void (GLAPIENTRY * Vertex3iv)(const GLint *); - void (GLAPIENTRY * Vertex3s)(GLshort, GLshort, GLshort); - void (GLAPIENTRY * Vertex3sv)(const GLshort *); - void (GLAPIENTRY * Vertex4d)(GLdouble, GLdouble, GLdouble, GLdouble); - void (GLAPIENTRY * Vertex4dv)(const GLdouble *); - void (GLAPIENTRY * Vertex4f)(GLfloat, GLfloat, GLfloat, GLfloat); - void (GLAPIENTRY * Vertex4fv)(const GLfloat *); - void (GLAPIENTRY * Vertex4i)(GLint, GLint, GLint, GLint); - void (GLAPIENTRY * Vertex4iv)(const GLint *); - void (GLAPIENTRY * Vertex4s)(GLshort, GLshort, GLshort, GLshort); - void (GLAPIENTRY * Vertex4sv)(const GLshort *); - void (GLAPIENTRY * ClipPlane)(GLenum, const GLdouble *); - void (GLAPIENTRY * ColorMaterial)(GLenum, GLenum); - void (GLAPIENTRY * CullFace)(GLenum); - void (GLAPIENTRY * Fogf)(GLenum, GLfloat); - void (GLAPIENTRY * Fogfv)(GLenum, const GLfloat *); - void (GLAPIENTRY * Fogi)(GLenum, GLint); - void (GLAPIENTRY * Fogiv)(GLenum, const GLint *); - void (GLAPIENTRY * FrontFace)(GLenum); - void (GLAPIENTRY * Hint)(GLenum, GLenum); - void (GLAPIENTRY * Lightf)(GLenum, GLenum, GLfloat); - void (GLAPIENTRY * Lightfv)(GLenum, GLenum, const GLfloat *); - void (GLAPIENTRY * Lighti)(GLenum, GLenum, GLint); - void (GLAPIENTRY * Lightiv)(GLenum, GLenum, const GLint *); - void (GLAPIENTRY * LightModelf)(GLenum, GLfloat); - void (GLAPIENTRY * LightModelfv)(GLenum, const GLfloat *); - void (GLAPIENTRY * LightModeli)(GLenum, GLint); - void (GLAPIENTRY * LightModeliv)(GLenum, const GLint *); - void (GLAPIENTRY * LineStipple)(GLint, GLushort); - void (GLAPIENTRY * LineWidth)(GLfloat); - void (GLAPIENTRY * Materialf)(GLenum, GLenum, GLfloat); - void (GLAPIENTRY * Materialfv)(GLenum, GLenum, const GLfloat *); - void (GLAPIENTRY * Materiali)(GLenum, GLenum, GLint); - void (GLAPIENTRY * Materialiv)(GLenum, GLenum, const GLint *); - void (GLAPIENTRY * PointSize)(GLfloat); - void (GLAPIENTRY * PolygonMode)(GLenum, GLenum); - void (GLAPIENTRY * PolygonStipple)(const GLubyte *); - void (GLAPIENTRY * Scissor)(GLint, GLint, GLsizei, GLsizei); - void (GLAPIENTRY * ShadeModel)(GLenum); - void (GLAPIENTRY * TexParameterf)(GLenum, GLenum, GLfloat); - void (GLAPIENTRY * TexParameterfv)(GLenum, GLenum, const GLfloat *); - void (GLAPIENTRY * TexParameteri)(GLenum, GLenum, GLint); - void (GLAPIENTRY * TexParameteriv)(GLenum, GLenum, const GLint *); - void (GLAPIENTRY * TexImage1D)(GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, const GLvoid *); - void (GLAPIENTRY * TexImage2D)(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); - void (GLAPIENTRY * TexEnvf)(GLenum, GLenum, GLfloat); - void (GLAPIENTRY * TexEnvfv)(GLenum, GLenum, const GLfloat *); - void (GLAPIENTRY * TexEnvi)(GLenum, GLenum, GLint); - void (GLAPIENTRY * TexEnviv)(GLenum, GLenum, const GLint *); - void (GLAPIENTRY * TexGend)(GLenum, GLenum, GLdouble); - void (GLAPIENTRY * TexGendv)(GLenum, GLenum, const GLdouble *); - void (GLAPIENTRY * TexGenf)(GLenum, GLenum, GLfloat); - void (GLAPIENTRY * TexGenfv)(GLenum, GLenum, const GLfloat *); - void (GLAPIENTRY * TexGeni)(GLenum, GLenum, GLint); - void (GLAPIENTRY * TexGeniv)(GLenum, GLenum, const GLint *); - void (GLAPIENTRY * FeedbackBuffer)(GLsizei, GLenum, GLfloat *); - void (GLAPIENTRY * SelectBuffer)(GLsizei, GLuint *); - GLint (GLAPIENTRY * RenderMode)(GLenum); - void (GLAPIENTRY * InitNames)(void); - void (GLAPIENTRY * LoadName)(GLuint); - void (GLAPIENTRY * PassThrough)(GLfloat); - void (GLAPIENTRY * PopName)(void); - void (GLAPIENTRY * PushName)(GLuint); - void (GLAPIENTRY * DrawBuffer)(GLenum); - void (GLAPIENTRY * Clear)(GLbitfield); - void (GLAPIENTRY * ClearAccum)(GLfloat, GLfloat, GLfloat, GLfloat); - void (GLAPIENTRY * ClearIndex)(GLfloat); - void (GLAPIENTRY * ClearColor)(GLclampf, GLclampf, GLclampf, GLclampf); - void (GLAPIENTRY * ClearStencil)(GLint); - void (GLAPIENTRY * ClearDepth)(GLclampd); - void (GLAPIENTRY * StencilMask)(GLuint); - void (GLAPIENTRY * ColorMask)(GLboolean, GLboolean, GLboolean, GLboolean); - void (GLAPIENTRY * DepthMask)(GLboolean); - void (GLAPIENTRY * IndexMask)(GLuint); - void (GLAPIENTRY * Accum)(GLenum, GLfloat); - void (GLAPIENTRY * Disable)(GLenum); - void (GLAPIENTRY * Enable)(GLenum); - void (GLAPIENTRY * Finish)(void); - void (GLAPIENTRY * Flush)(void); - void (GLAPIENTRY * PopAttrib)(void); - void (GLAPIENTRY * PushAttrib)(GLbitfield); - void (GLAPIENTRY * Map1d)(GLenum, GLdouble, GLdouble, GLint, GLint, const GLdouble *); - void (GLAPIENTRY * Map1f)(GLenum, GLfloat, GLfloat, GLint, GLint, const GLfloat *); - void (GLAPIENTRY * Map2d)(GLenum, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, const GLdouble *); - void (GLAPIENTRY * Map2f)(GLenum, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, const GLfloat *); - void (GLAPIENTRY * MapGrid1d)(GLint, GLdouble, GLdouble); - void (GLAPIENTRY * MapGrid1f)(GLint, GLfloat, GLfloat); - void (GLAPIENTRY * MapGrid2d)(GLint, GLdouble, GLdouble, GLint, GLdouble, GLdouble); - void (GLAPIENTRY * MapGrid2f)(GLint, GLfloat, GLfloat, GLint, GLfloat, GLfloat); - void (GLAPIENTRY * EvalCoord1d)(GLdouble); - void (GLAPIENTRY * EvalCoord1dv)(const GLdouble *); - void (GLAPIENTRY * EvalCoord1f)(GLfloat); - void (GLAPIENTRY * EvalCoord1fv)(const GLfloat *); - void (GLAPIENTRY * EvalCoord2d)(GLdouble, GLdouble); - void (GLAPIENTRY * EvalCoord2dv)(const GLdouble *); - void (GLAPIENTRY * EvalCoord2f)(GLfloat, GLfloat); - void (GLAPIENTRY * EvalCoord2fv)(const GLfloat *); - void (GLAPIENTRY * EvalMesh1)(GLenum, GLint, GLint); - void (GLAPIENTRY * EvalPoint1)(GLint); - void (GLAPIENTRY * EvalMesh2)(GLenum, GLint, GLint, GLint, GLint); - void (GLAPIENTRY * EvalPoint2)(GLint, GLint); - void (GLAPIENTRY * AlphaFunc)(GLenum, GLclampf); - void (GLAPIENTRY * BlendFunc)(GLenum, GLenum); - void (GLAPIENTRY * LogicOp)(GLenum); - void (GLAPIENTRY * StencilFunc)(GLenum, GLint, GLuint); - void (GLAPIENTRY * StencilOp)(GLenum, GLenum, GLenum); - void (GLAPIENTRY * DepthFunc)(GLenum); - void (GLAPIENTRY * PixelZoom)(GLfloat, GLfloat); - void (GLAPIENTRY * PixelTransferf)(GLenum, GLfloat); - void (GLAPIENTRY * PixelTransferi)(GLenum, GLint); - void (GLAPIENTRY * PixelStoref)(GLenum, GLfloat); - void (GLAPIENTRY * PixelStorei)(GLenum, GLint); - void (GLAPIENTRY * PixelMapfv)(GLenum, GLint, const GLfloat *); - void (GLAPIENTRY * PixelMapuiv)(GLenum, GLint, const GLuint *); - void (GLAPIENTRY * PixelMapusv)(GLenum, GLint, const GLushort *); - void (GLAPIENTRY * ReadBuffer)(GLenum); - void (GLAPIENTRY * CopyPixels)(GLint, GLint, GLsizei, GLsizei, GLenum); - void (GLAPIENTRY * ReadPixels)(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid *); - void (GLAPIENTRY * DrawPixels)(GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); - void (GLAPIENTRY * GetBooleanv)(GLenum, GLboolean *); - void (GLAPIENTRY * GetClipPlane)(GLenum, GLdouble *); - void (GLAPIENTRY * GetDoublev)(GLenum, GLdouble *); - GLenum (GLAPIENTRY * GetError)(void); - void (GLAPIENTRY * GetFloatv)(GLenum, GLfloat *); - void (GLAPIENTRY * GetIntegerv)(GLenum, GLint *); - void (GLAPIENTRY * GetLightfv)(GLenum, GLenum, GLfloat *); - void (GLAPIENTRY * GetLightiv)(GLenum, GLenum, GLint *); - void (GLAPIENTRY * GetMapdv)(GLenum, GLenum, GLdouble *); - void (GLAPIENTRY * GetMapfv)(GLenum, GLenum, GLfloat *); - void (GLAPIENTRY * GetMapiv)(GLenum, GLenum, GLint *); - void (GLAPIENTRY * GetMaterialfv)(GLenum, GLenum, GLfloat *); - void (GLAPIENTRY * GetMaterialiv)(GLenum, GLenum, GLint *); - void (GLAPIENTRY * GetPixelMapfv)(GLenum, GLfloat *); - void (GLAPIENTRY * GetPixelMapuiv)(GLenum, GLuint *); - void (GLAPIENTRY * GetPixelMapusv)(GLenum, GLushort *); - void (GLAPIENTRY * GetPolygonStipple)(GLubyte *); - const GLubyte * (GLAPIENTRY * GetString)(GLenum); - void (GLAPIENTRY * GetTexEnvfv)(GLenum, GLenum, GLfloat *); - void (GLAPIENTRY * GetTexEnviv)(GLenum, GLenum, GLint *); - void (GLAPIENTRY * GetTexGendv)(GLenum, GLenum, GLdouble *); - void (GLAPIENTRY * GetTexGenfv)(GLenum, GLenum, GLfloat *); - void (GLAPIENTRY * GetTexGeniv)(GLenum, GLenum, GLint *); - void (GLAPIENTRY * GetTexImage)(GLenum, GLint, GLenum, GLenum, GLvoid *); - void (GLAPIENTRY * GetTexParameterfv)(GLenum, GLenum, GLfloat *); - void (GLAPIENTRY * GetTexParameteriv)(GLenum, GLenum, GLint *); - void (GLAPIENTRY * GetTexLevelParameterfv)(GLenum, GLint, GLenum, GLfloat *); - void (GLAPIENTRY * GetTexLevelParameteriv)(GLenum, GLint, GLenum, GLint *); - GLboolean (GLAPIENTRY * IsEnabled)(GLenum); - GLboolean (GLAPIENTRY * IsList)(GLuint); - void (GLAPIENTRY * DepthRange)(GLclampd, GLclampd); - void (GLAPIENTRY * Frustum)(GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble); - void (GLAPIENTRY * LoadIdentity)(void); - void (GLAPIENTRY * LoadMatrixf)(const GLfloat *); - void (GLAPIENTRY * LoadMatrixd)(const GLdouble *); - void (GLAPIENTRY * MatrixMode)(GLenum); - void (GLAPIENTRY * MultMatrixf)(const GLfloat *); - void (GLAPIENTRY * MultMatrixd)(const GLdouble *); - void (GLAPIENTRY * Ortho)(GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble); - void (GLAPIENTRY * PopMatrix)(void); - void (GLAPIENTRY * PushMatrix)(void); - void (GLAPIENTRY * Rotated)(GLdouble, GLdouble, GLdouble, GLdouble); - void (GLAPIENTRY * Rotatef)(GLfloat, GLfloat, GLfloat, GLfloat); - void (GLAPIENTRY * Scaled)(GLdouble, GLdouble, GLdouble); - void (GLAPIENTRY * Scalef)(GLfloat, GLfloat, GLfloat); - void (GLAPIENTRY * Translated)(GLdouble, GLdouble, GLdouble); - void (GLAPIENTRY * Translatef)(GLfloat, GLfloat, GLfloat); - void (GLAPIENTRY * Viewport)(GLint, GLint, GLsizei, GLsizei); - void (GLAPIENTRY * ArrayElement)(GLint); - void (GLAPIENTRY * BindTexture)(GLenum, GLuint); - void (GLAPIENTRY * ColorPointer)(GLint, GLenum, GLsizei, const GLvoid *); - void (GLAPIENTRY * DisableClientState)(GLenum); - void (GLAPIENTRY * DrawArrays)(GLenum, GLint, GLsizei); - void (GLAPIENTRY * DrawElements)(GLenum, GLsizei, GLenum, const GLvoid *); - void (GLAPIENTRY * EdgeFlagPointer)(GLsizei, const GLvoid *); - void (GLAPIENTRY * EnableClientState)(GLenum); - void (GLAPIENTRY * IndexPointer)(GLenum, GLsizei, const GLvoid *); - void (GLAPIENTRY * Indexub)(GLubyte); - void (GLAPIENTRY * Indexubv)(const GLubyte *); - void (GLAPIENTRY * InterleavedArrays)(GLenum, GLsizei, const GLvoid *); - void (GLAPIENTRY * NormalPointer)(GLenum, GLsizei, const GLvoid *); - void (GLAPIENTRY * PolygonOffset)(GLfloat, GLfloat); - void (GLAPIENTRY * TexCoordPointer)(GLint, GLenum, GLsizei, const GLvoid *); - void (GLAPIENTRY * VertexPointer)(GLint, GLenum, GLsizei, const GLvoid *); - GLboolean (GLAPIENTRY * AreTexturesResident)(GLsizei, const GLuint *, GLboolean *); - void (GLAPIENTRY * CopyTexImage1D)(GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint); - void (GLAPIENTRY * CopyTexImage2D)(GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint); - void (GLAPIENTRY * CopyTexSubImage1D)(GLenum, GLint, GLint, GLint, GLint, GLsizei); - void (GLAPIENTRY * CopyTexSubImage2D)(GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); - void (GLAPIENTRY * DeleteTextures)(GLsizei, const GLuint *); - void (GLAPIENTRY * GenTextures)(GLsizei, GLuint *); - void (GLAPIENTRY * GetPointerv)(GLenum, GLvoid **); - GLboolean (GLAPIENTRY * IsTexture)(GLuint); - void (GLAPIENTRY * PrioritizeTextures)(GLsizei, const GLuint *, const GLclampf *); - void (GLAPIENTRY * TexSubImage1D)(GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const GLvoid *); - void (GLAPIENTRY * TexSubImage2D)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); - void (GLAPIENTRY * PopClientAttrib)(void); - void (GLAPIENTRY * PushClientAttrib)(GLbitfield); -}; - -typedef struct __GLdispatchTableRec GLDISPATCHTABLE; - -typedef struct _GLCLTPROCTABLE -{ - int cEntries; - GLDISPATCHTABLE glDispatchTable; -} GLCLTPROCTABLE, * PGLCLTPROCTABLE; - -typedef VOID (APIENTRY * PFN_SETPROCTABLE)(PGLCLTPROCTABLE); - -BOOL APIENTRY -DrvCopyContext( - DHGLRC dhrcSource, - DHGLRC dhrcDest, - UINT fuMask ); - -DHGLRC APIENTRY -DrvCreateLayerContext( - HDC hdc, - INT iLayerPlane ); - -DHGLRC APIENTRY -DrvCreateContext( - HDC hdc ); - -BOOL APIENTRY -DrvDeleteContext( - DHGLRC dhglrc ); - -BOOL APIENTRY -DrvDescribeLayerPlane( - HDC hdc, - INT iPixelFormat, - INT iLayerPlane, - UINT nBytes, - LPLAYERPLANEDESCRIPTOR plpd ); - -LONG APIENTRY -DrvDescribePixelFormat( - HDC hdc, - INT iPixelFormat, - ULONG cjpfd, - PIXELFORMATDESCRIPTOR *ppfd ); - -int APIENTRY -DrvGetLayerPaletteEntries( - HDC hdc, - INT iLayerPlane, - INT iStart, - INT cEntries, - COLORREF *pcr ); - -PROC APIENTRY -DrvGetProcAddress( - LPCSTR lpszProc ); - -BOOL APIENTRY -DrvRealizeLayerPalette( - HDC hdc, - INT iLayerPlane, - BOOL bRealize ); - -BOOL APIENTRY -DrvReleaseContext( - DHGLRC dhglrc ); - -void APIENTRY -DrvSetCallbackProcs( - INT nProcs, - PROC *pProcs ); - -PGLCLTPROCTABLE APIENTRY -DrvSetContext( - HDC hdc, - DHGLRC dhglrc, - PFN_SETPROCTABLE pfnSetProcTable ); - -int APIENTRY -DrvSetLayerPaletteEntries( - HDC hdc, - INT iLayerPlane, - INT iStart, - INT cEntries, - CONST COLORREF *pcr ); - -BOOL APIENTRY -DrvSetPixelFormat( - HDC hdc, - LONG iPixelFormat ); - -BOOL APIENTRY -DrvShareLists( - DHGLRC dhglrc1, - DHGLRC dhglrc2 ); - -BOOL APIENTRY -DrvSwapBuffers( - HDC hdc ); - -BOOL APIENTRY -DrvSwapLayerBuffers( - HDC hdc, - UINT fuPlanes ); - -BOOL APIENTRY -DrvValidateVersion( - ULONG ulVersion ); - -#endif /* DRV_H */ diff --git a/src/mesa/state_tracker/wgl/stw_pixelformat.c b/src/mesa/state_tracker/wgl/stw_pixelformat.c deleted file mode 100644 index 7a054af3d3..0000000000 --- a/src/mesa/state_tracker/wgl/stw_pixelformat.c +++ /dev/null @@ -1,120 +0,0 @@ -/************************************************************************** - * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include "pipe/p_debug.h" -#include "stw_pixelformat.h" - -#define MAX_PIXELFORMATS 16 - -static struct pixelformat_info pixelformats[MAX_PIXELFORMATS]; -static uint pixelformat_count = 0; -static uint pixelformat_extended_count = 0; - -static void -add_standard_pixelformats( - struct pixelformat_info **ppf, - uint flags ) -{ - struct pixelformat_info *pf = *ppf; - struct pixelformat_color_info color24 = { 8, 0, 8, 8, 8, 16 }; - struct pixelformat_alpha_info alpha8 = { 8, 24 }; - struct pixelformat_alpha_info noalpha = { 0, 0 }; - struct pixelformat_depth_info depth24s8 = { 24, 8 }; - struct pixelformat_depth_info depth16 = { 16, 0 }; - - pf->flags = PF_FLAG_DOUBLEBUFFER | flags; - pf->color = color24; - pf->alpha = alpha8; - pf->depth = depth16; - pf++; - - pf->flags = PF_FLAG_DOUBLEBUFFER | flags; - pf->color = color24; - pf->alpha = alpha8; - pf->depth = depth24s8; - pf++; - - pf->flags = PF_FLAG_DOUBLEBUFFER | flags; - pf->color = color24; - pf->alpha = noalpha; - pf->depth = depth16; - pf++; - - pf->flags = PF_FLAG_DOUBLEBUFFER | flags; - pf->color = color24; - pf->alpha = noalpha; - pf->depth = depth24s8; - pf++; - - pf->flags = flags; - pf->color = color24; - pf->alpha = noalpha; - pf->depth = depth16; - pf++; - - pf->flags = flags; - pf->color = color24; - pf->alpha = noalpha; - pf->depth = depth24s8; - pf++; - - *ppf = pf; -} - -void -pixelformat_init( void ) -{ - struct pixelformat_info *pf = pixelformats; - - add_standard_pixelformats( &pf, 0 ); - pixelformat_count = pf - pixelformats; - - add_standard_pixelformats( &pf, PF_FLAG_MULTISAMPLED ); - pixelformat_extended_count = pf - pixelformats; - - assert( pixelformat_extended_count <= MAX_PIXELFORMATS ); -} - -uint -pixelformat_get_count( void ) -{ - return pixelformat_count; -} - -uint -pixelformat_get_extended_count( void ) -{ - return pixelformat_extended_count; -} - -const struct pixelformat_info * -pixelformat_get_info( uint index ) -{ - assert( index < pixelformat_extended_count ); - - return &pixelformats[index]; -} diff --git a/src/mesa/state_tracker/wgl/stw_pixelformat.h b/src/mesa/state_tracker/wgl/stw_pixelformat.h deleted file mode 100644 index 0b67da8d25..0000000000 --- a/src/mesa/state_tracker/wgl/stw_pixelformat.h +++ /dev/null @@ -1,76 +0,0 @@ -/************************************************************************** - * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#ifndef PIXELFORMAT_H -#define PIXELFORMAT_H - -#define PF_FLAG_DOUBLEBUFFER 0x00000001 -#define PF_FLAG_MULTISAMPLED 0x00000002 - -struct pixelformat_color_info -{ - uint redbits; - uint redshift; - uint greenbits; - uint greenshift; - uint bluebits; - uint blueshift; -}; - -struct pixelformat_alpha_info -{ - uint alphabits; - uint alphashift; -}; - -struct pixelformat_depth_info -{ - uint depthbits; - uint stencilbits; -}; - -struct pixelformat_info -{ - uint flags; - struct pixelformat_color_info color; - struct pixelformat_alpha_info alpha; - struct pixelformat_depth_info depth; -}; - -void -pixelformat_init( void ); - -uint -pixelformat_get_count( void ); - -uint -pixelformat_get_extended_count( void ); - -const struct pixelformat_info * -pixelformat_get_info( uint index ); - -#endif /* PIXELFORMAT_H */ diff --git a/src/mesa/state_tracker/wgl/stw_quirks.c b/src/mesa/state_tracker/wgl/stw_quirks.c deleted file mode 100644 index bf1ec3fee7..0000000000 --- a/src/mesa/state_tracker/wgl/stw_quirks.c +++ /dev/null @@ -1,108 +0,0 @@ -/************************************************************************** - * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -/** - * @file - * - * This is hopefully a temporary hack to define some needed dispatch - * table entries. Hopefully, I'll find a better solution. The - * dispatch table generation scripts ought to be making these dummy - * stubs as well. - */ - -void gl_dispatch_stub_543(void){} -void gl_dispatch_stub_544(void){} -void gl_dispatch_stub_545(void){} -void gl_dispatch_stub_546(void){} -void gl_dispatch_stub_547(void){} -void gl_dispatch_stub_548(void){} -void gl_dispatch_stub_549(void){} -void gl_dispatch_stub_550(void){} -void gl_dispatch_stub_551(void){} -void gl_dispatch_stub_552(void){} -void gl_dispatch_stub_553(void){} -void gl_dispatch_stub_554(void){} -void gl_dispatch_stub_555(void){} -void gl_dispatch_stub_556(void){} -void gl_dispatch_stub_557(void){} -void gl_dispatch_stub_558(void){} -void gl_dispatch_stub_559(void){} -void gl_dispatch_stub_560(void){} -void gl_dispatch_stub_561(void){} -void gl_dispatch_stub_565(void){} -void gl_dispatch_stub_566(void){} -void gl_dispatch_stub_577(void){} -void gl_dispatch_stub_578(void){} -void gl_dispatch_stub_603(void){} -void gl_dispatch_stub_645(void){} -void gl_dispatch_stub_646(void){} -void gl_dispatch_stub_647(void){} -void gl_dispatch_stub_648(void){} -void gl_dispatch_stub_649(void){} -void gl_dispatch_stub_650(void){} -void gl_dispatch_stub_651(void){} -void gl_dispatch_stub_652(void){} -void gl_dispatch_stub_653(void){} -void gl_dispatch_stub_733(void){} -void gl_dispatch_stub_734(void){} -void gl_dispatch_stub_735(void){} -void gl_dispatch_stub_736(void){} -void gl_dispatch_stub_737(void){} -void gl_dispatch_stub_738(void){} -void gl_dispatch_stub_744(void){} -void gl_dispatch_stub_745(void){} -void gl_dispatch_stub_746(void){} -void gl_dispatch_stub_760(void){} -void gl_dispatch_stub_761(void){} -void gl_dispatch_stub_763(void){} -void gl_dispatch_stub_765(void){} -void gl_dispatch_stub_766(void){} -void gl_dispatch_stub_767(void){} -void gl_dispatch_stub_768(void){} - -void gl_dispatch_stub_562(void){} -void gl_dispatch_stub_563(void){} -void gl_dispatch_stub_564(void){} -void gl_dispatch_stub_567(void){} -void gl_dispatch_stub_568(void){} -void gl_dispatch_stub_569(void){} -void gl_dispatch_stub_580(void){} -void gl_dispatch_stub_581(void){} -void gl_dispatch_stub_606(void){} -void gl_dispatch_stub_654(void){} -void gl_dispatch_stub_655(void){} -void gl_dispatch_stub_656(void){} -void gl_dispatch_stub_739(void){} -void gl_dispatch_stub_740(void){} -void gl_dispatch_stub_741(void){} -void gl_dispatch_stub_748(void){} -void gl_dispatch_stub_749(void){} -void gl_dispatch_stub_769(void){} -void gl_dispatch_stub_770(void){} -void gl_dispatch_stub_771(void){} -void gl_dispatch_stub_772(void){} -void gl_dispatch_stub_773(void){} diff --git a/src/mesa/state_tracker/wgl/stw_wgl.c b/src/mesa/state_tracker/wgl/stw_wgl.c deleted file mode 100644 index 0528c369fc..0000000000 --- a/src/mesa/state_tracker/wgl/stw_wgl.c +++ /dev/null @@ -1,199 +0,0 @@ -/************************************************************************** - * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include <windows.h> - -#include "pipe/p_debug.h" - -WINGDIAPI BOOL APIENTRY -wglUseFontBitmapsA( - HDC hdc, - DWORD first, - DWORD count, - DWORD listBase ) -{ - (void) hdc; - (void) first; - (void) count; - (void) listBase; - - assert( 0 ); - - return FALSE; -} - -WINGDIAPI BOOL APIENTRY -wglShareLists( - HGLRC hglrc1, - HGLRC hglrc2 ) -{ - (void) hglrc1; - (void) hglrc2; - - assert( 0 ); - - return FALSE; -} - -WINGDIAPI BOOL APIENTRY -wglUseFontBitmapsW( - HDC hdc, - DWORD first, - DWORD count, - DWORD listBase ) -{ - (void) hdc; - (void) first; - (void) count; - (void) listBase; - - assert( 0 ); - - return FALSE; -} - -WINGDIAPI BOOL APIENTRY -wglUseFontOutlinesA( - HDC hdc, - DWORD first, - DWORD count, - DWORD listBase, - FLOAT deviation, - FLOAT extrusion, - int format, - LPGLYPHMETRICSFLOAT lpgmf ) -{ - (void) hdc; - (void) first; - (void) count; - (void) listBase; - (void) deviation; - (void) extrusion; - (void) format; - (void) lpgmf; - - assert( 0 ); - - return FALSE; -} - -WINGDIAPI BOOL APIENTRY -wglUseFontOutlinesW( - HDC hdc, - DWORD first, - DWORD count, - DWORD listBase, - FLOAT deviation, - FLOAT extrusion, - int format, - LPGLYPHMETRICSFLOAT lpgmf ) -{ - (void) hdc; - (void) first; - (void) count; - (void) listBase; - (void) deviation; - (void) extrusion; - (void) format; - (void) lpgmf; - - assert( 0 ); - - return FALSE; -} - -WINGDIAPI BOOL APIENTRY -wglDescribeLayerPlane( - HDC hdc, - int iPixelFormat, - int iLayerPlane, - UINT nBytes, - LPLAYERPLANEDESCRIPTOR plpd ) -{ - (void) hdc; - (void) iPixelFormat; - (void) iLayerPlane; - (void) nBytes; - (void) plpd; - - assert( 0 ); - - return FALSE; -} - -WINGDIAPI int APIENTRY -wglSetLayerPaletteEntries( - HDC hdc, - int iLayerPlane, - int iStart, - int cEntries, - CONST COLORREF *pcr ) -{ - (void) hdc; - (void) iLayerPlane; - (void) iStart; - (void) cEntries; - (void) pcr; - - assert( 0 ); - - return 0; -} - -WINGDIAPI int APIENTRY -wglGetLayerPaletteEntries( - HDC hdc, - int iLayerPlane, - int iStart, - int cEntries, - COLORREF *pcr ) -{ - (void) hdc; - (void) iLayerPlane; - (void) iStart; - (void) cEntries; - (void) pcr; - - assert( 0 ); - - return 0; -} - -WINGDIAPI BOOL APIENTRY -wglRealizeLayerPalette( - HDC hdc, - int iLayerPlane, - BOOL bRealize ) -{ - (void) hdc; - (void) iLayerPlane; - (void) bRealize; - - assert( 0 ); - - return FALSE; -} diff --git a/src/mesa/state_tracker/wgl/stw_wgl.h b/src/mesa/state_tracker/wgl/stw_wgl.h deleted file mode 100644 index b86cc240f2..0000000000 --- a/src/mesa/state_tracker/wgl/stw_wgl.h +++ /dev/null @@ -1,63 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 VMware, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#ifndef STW_WGL_H_ -#define STW_WGL_H_ - - -#include <windows.h> - -#include "GL/gl.h" - - -/* - * Undeclared APIs exported by opengl32.dll - */ - -WINGDIAPI BOOL WINAPI -wglSwapBuffers(HDC hdc); - -WINGDIAPI int WINAPI -wglChoosePixelFormat(HDC hdc, - CONST PIXELFORMATDESCRIPTOR *ppfd); - -WINGDIAPI int WINAPI -wglDescribePixelFormat(HDC hdc, - int iPixelFormat, - UINT nBytes, - LPPIXELFORMATDESCRIPTOR ppfd); - -WINGDIAPI int WINAPI -wglGetPixelFormat(HDC hdc); - -WINGDIAPI BOOL WINAPI -wglSetPixelFormat(HDC hdc, - int iPixelFormat, - CONST PIXELFORMATDESCRIPTOR *ppfd); - - -#endif /* STW_WGL_H_ */ diff --git a/src/mesa/state_tracker/wgl/stw_wgl_arbextensionsstring.h b/src/mesa/state_tracker/wgl/stw_wgl_arbextensionsstring.h deleted file mode 100644 index a0e4c5d98e..0000000000 --- a/src/mesa/state_tracker/wgl/stw_wgl_arbextensionsstring.h +++ /dev/null @@ -1,35 +0,0 @@ -/************************************************************************** - * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#ifndef WGL_ARBEXTENSIONSSTRING_H -#define WGL_ARBEXTENSIONSSTRING_H - -WINGDIAPI const char * APIENTRY -wglGetExtensionsStringARB( - HDC hdc ); - -#endif /* WGL_ARBEXTENSIONSSTRING_H */ diff --git a/src/mesa/state_tracker/wgl/stw_wgl_arbmultisample.h b/src/mesa/state_tracker/wgl/stw_wgl_arbmultisample.h deleted file mode 100644 index de3e2cc6a3..0000000000 --- a/src/mesa/state_tracker/wgl/stw_wgl_arbmultisample.h +++ /dev/null @@ -1,40 +0,0 @@ -/************************************************************************** - * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#ifndef WGL_ARBMULTISAMPLE_H -#define WGL_ARBMULTISAMPLE_H - -#define WGL_SAMPLE_BUFFERS_ARB 0x2041 -#define WGL_SAMPLES_ARB 0x2042 - -int -wgl_query_sample_buffers( void ); - -int -wgl_query_samples( void ); - -#endif /* WGL_ARBMULTISAMPLE_H */ diff --git a/src/mesa/state_tracker/wgl/stw_wgl_arbpixelformat.c b/src/mesa/state_tracker/wgl/stw_wgl_arbpixelformat.c deleted file mode 100644 index 344bb15d3c..0000000000 --- a/src/mesa/state_tracker/wgl/stw_wgl_arbpixelformat.c +++ /dev/null @@ -1,513 +0,0 @@ -/************************************************************************** - * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include <windows.h> - -#include "pipe/p_compiler.h" -#include "util/u_memory.h" -#include "stw_pixelformat.h" -#include "stw_wgl_arbmultisample.h" -#include "stw_wgl_arbpixelformat.h" - -#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000 -#define WGL_DRAW_TO_WINDOW_ARB 0x2001 -#define WGL_DRAW_TO_BITMAP_ARB 0x2002 -#define WGL_ACCELERATION_ARB 0x2003 -#define WGL_NEED_PALETTE_ARB 0x2004 -#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005 -#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006 -#define WGL_SWAP_METHOD_ARB 0x2007 -#define WGL_NUMBER_OVERLAYS_ARB 0x2008 -#define WGL_NUMBER_UNDERLAYS_ARB 0x2009 -#define WGL_TRANSPARENT_ARB 0x200A -#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037 -#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038 -#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039 -#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A -#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B -#define WGL_SHARE_DEPTH_ARB 0x200C -#define WGL_SHARE_STENCIL_ARB 0x200D -#define WGL_SHARE_ACCUM_ARB 0x200E -#define WGL_SUPPORT_GDI_ARB 0x200F -#define WGL_SUPPORT_OPENGL_ARB 0x2010 -#define WGL_DOUBLE_BUFFER_ARB 0x2011 -#define WGL_STEREO_ARB 0x2012 -#define WGL_PIXEL_TYPE_ARB 0x2013 -#define WGL_COLOR_BITS_ARB 0x2014 -#define WGL_RED_BITS_ARB 0x2015 -#define WGL_RED_SHIFT_ARB 0x2016 -#define WGL_GREEN_BITS_ARB 0x2017 -#define WGL_GREEN_SHIFT_ARB 0x2018 -#define WGL_BLUE_BITS_ARB 0x2019 -#define WGL_BLUE_SHIFT_ARB 0x201A -#define WGL_ALPHA_BITS_ARB 0x201B -#define WGL_ALPHA_SHIFT_ARB 0x201C -#define WGL_ACCUM_BITS_ARB 0x201D -#define WGL_ACCUM_RED_BITS_ARB 0x201E -#define WGL_ACCUM_GREEN_BITS_ARB 0x201F -#define WGL_ACCUM_BLUE_BITS_ARB 0x2020 -#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021 -#define WGL_DEPTH_BITS_ARB 0x2022 -#define WGL_STENCIL_BITS_ARB 0x2023 -#define WGL_AUX_BUFFERS_ARB 0x2024 - -#define WGL_NO_ACCELERATION_ARB 0x2025 -#define WGL_GENERIC_ACCELERATION_ARB 0x2026 -#define WGL_FULL_ACCELERATION_ARB 0x2027 - -#define WGL_SWAP_EXCHANGE_ARB 0x2028 -#define WGL_SWAP_COPY_ARB 0x2029 -#define WGL_SWAP_UNDEFINED_ARB 0x202A - -#define WGL_TYPE_RGBA_ARB 0x202B -#define WGL_TYPE_COLORINDEX_ARB 0x202C - -static boolean -query_attrib( - int iPixelFormat, - int iLayerPlane, - int attrib, - int *pvalue ) -{ - uint count; - uint index; - const struct pixelformat_info *pf; - - count = pixelformat_get_extended_count(); - - if (attrib == WGL_NUMBER_PIXEL_FORMATS_ARB) { - *pvalue = (int) count; - return TRUE; - } - - index = (uint) iPixelFormat - 1; - if (index >= count) - return FALSE; - - pf = pixelformat_get_info( index ); - - switch (attrib) { - case WGL_DRAW_TO_WINDOW_ARB: - *pvalue = TRUE; - return TRUE; - - case WGL_DRAW_TO_BITMAP_ARB: - *pvalue = FALSE; - return TRUE; - - case WGL_NEED_PALETTE_ARB: - *pvalue = FALSE; - return TRUE; - - case WGL_NEED_SYSTEM_PALETTE_ARB: - *pvalue = FALSE; - return TRUE; - - case WGL_SWAP_METHOD_ARB: - if (pf->flags & PF_FLAG_DOUBLEBUFFER) - *pvalue = WGL_SWAP_COPY_ARB; - else - *pvalue = WGL_SWAP_UNDEFINED_ARB; - return TRUE; - - case WGL_SWAP_LAYER_BUFFERS_ARB: - *pvalue = FALSE; - return TRUE; - - case WGL_NUMBER_OVERLAYS_ARB: - *pvalue = 0; - return TRUE; - - case WGL_NUMBER_UNDERLAYS_ARB: - *pvalue = 0; - return TRUE; - } - - if (iLayerPlane != 0) - return FALSE; - - switch (attrib) { - case WGL_ACCELERATION_ARB: - *pvalue = WGL_FULL_ACCELERATION_ARB; - break; - - case WGL_TRANSPARENT_ARB: - *pvalue = FALSE; - break; - - case WGL_TRANSPARENT_RED_VALUE_ARB: - case WGL_TRANSPARENT_GREEN_VALUE_ARB: - case WGL_TRANSPARENT_BLUE_VALUE_ARB: - case WGL_TRANSPARENT_ALPHA_VALUE_ARB: - case WGL_TRANSPARENT_INDEX_VALUE_ARB: - break; - - case WGL_SHARE_DEPTH_ARB: - case WGL_SHARE_STENCIL_ARB: - case WGL_SHARE_ACCUM_ARB: - *pvalue = TRUE; - break; - - case WGL_SUPPORT_GDI_ARB: - *pvalue = FALSE; - break; - - case WGL_SUPPORT_OPENGL_ARB: - *pvalue = TRUE; - break; - - case WGL_DOUBLE_BUFFER_ARB: - if (pf->flags & PF_FLAG_DOUBLEBUFFER) - *pvalue = TRUE; - else - *pvalue = FALSE; - break; - - case WGL_STEREO_ARB: - *pvalue = FALSE; - break; - - case WGL_PIXEL_TYPE_ARB: - *pvalue = WGL_TYPE_RGBA_ARB; - break; - - case WGL_COLOR_BITS_ARB: - *pvalue = (int) (pf->color.redbits + pf->color.greenbits + pf->color.bluebits); - break; - - case WGL_RED_BITS_ARB: - *pvalue = (int) pf->color.redbits; - break; - - case WGL_RED_SHIFT_ARB: - *pvalue = (int) pf->color.redshift; - break; - - case WGL_GREEN_BITS_ARB: - *pvalue = (int) pf->color.greenbits; - break; - - case WGL_GREEN_SHIFT_ARB: - *pvalue = (int) pf->color.greenshift; - break; - - case WGL_BLUE_BITS_ARB: - *pvalue = (int) pf->color.bluebits; - break; - - case WGL_BLUE_SHIFT_ARB: - *pvalue = (int) pf->color.blueshift; - break; - - case WGL_ALPHA_BITS_ARB: - *pvalue = (int) pf->alpha.alphabits; - break; - - case WGL_ALPHA_SHIFT_ARB: - *pvalue = (int) pf->alpha.alphashift; - break; - - case WGL_ACCUM_BITS_ARB: - case WGL_ACCUM_RED_BITS_ARB: - case WGL_ACCUM_GREEN_BITS_ARB: - case WGL_ACCUM_BLUE_BITS_ARB: - case WGL_ACCUM_ALPHA_BITS_ARB: - *pvalue = 0; - break; - - case WGL_DEPTH_BITS_ARB: - *pvalue = (int) pf->depth.depthbits; - break; - - case WGL_STENCIL_BITS_ARB: - *pvalue = (int) pf->depth.stencilbits; - break; - - case WGL_AUX_BUFFERS_ARB: - *pvalue = 0; - break; - - case WGL_SAMPLE_BUFFERS_ARB: - if (pf->flags & PF_FLAG_MULTISAMPLED) - *pvalue = wgl_query_sample_buffers(); - else - *pvalue = 0; - break; - - case WGL_SAMPLES_ARB: - if (pf->flags & PF_FLAG_MULTISAMPLED) - *pvalue = wgl_query_samples(); - else - *pvalue = 0; - break; - - default: - return FALSE; - } - - return TRUE; -} - -struct attrib_match_info -{ - int attribute; - int weight; - BOOL exact; -}; - -static struct attrib_match_info attrib_match[] = { - - /* WGL_ARB_pixel_format */ - { WGL_DRAW_TO_WINDOW_ARB, 0, TRUE }, - { WGL_DRAW_TO_BITMAP_ARB, 0, TRUE }, - { WGL_ACCELERATION_ARB, 0, TRUE }, - { WGL_NEED_PALETTE_ARB, 0, TRUE }, - { WGL_NEED_SYSTEM_PALETTE_ARB, 0, TRUE }, - { WGL_SWAP_LAYER_BUFFERS_ARB, 0, TRUE }, - { WGL_SWAP_METHOD_ARB, 0, TRUE }, - { WGL_NUMBER_OVERLAYS_ARB, 4, FALSE }, - { WGL_NUMBER_UNDERLAYS_ARB, 4, FALSE }, - /*{ WGL_SHARE_DEPTH_ARB, 0, TRUE },*/ /* no overlays -- ignore */ - /*{ WGL_SHARE_STENCIL_ARB, 0, TRUE },*/ /* no overlays -- ignore */ - /*{ WGL_SHARE_ACCUM_ARB, 0, TRUE },*/ /* no overlays -- ignore */ - { WGL_SUPPORT_GDI_ARB, 0, TRUE }, - { WGL_SUPPORT_OPENGL_ARB, 0, TRUE }, - { WGL_DOUBLE_BUFFER_ARB, 0, TRUE }, - { WGL_STEREO_ARB, 0, TRUE }, - { WGL_PIXEL_TYPE_ARB, 0, TRUE }, - { WGL_COLOR_BITS_ARB, 1, FALSE }, - { WGL_RED_BITS_ARB, 1, FALSE }, - { WGL_GREEN_BITS_ARB, 1, FALSE }, - { WGL_BLUE_BITS_ARB, 1, FALSE }, - { WGL_ALPHA_BITS_ARB, 1, FALSE }, - { WGL_ACCUM_BITS_ARB, 1, FALSE }, - { WGL_ACCUM_RED_BITS_ARB, 1, FALSE }, - { WGL_ACCUM_GREEN_BITS_ARB, 1, FALSE }, - { WGL_ACCUM_BLUE_BITS_ARB, 1, FALSE }, - { WGL_ACCUM_ALPHA_BITS_ARB, 1, FALSE }, - { WGL_DEPTH_BITS_ARB, 1, FALSE }, - { WGL_STENCIL_BITS_ARB, 1, FALSE }, - { WGL_AUX_BUFFERS_ARB, 2, FALSE }, - - /* WGL_ARB_multisample */ - { WGL_SAMPLE_BUFFERS_ARB, 2, FALSE }, - { WGL_SAMPLES_ARB, 2, FALSE } -}; - -struct pixelformat_score -{ - int points; - uint index; -}; - -static BOOL -score_pixelformats( - struct pixelformat_score *scores, - uint count, - int attribute, - int expected_value ) -{ - uint i; - struct attrib_match_info *ami = NULL; - uint index; - - /* Find out if a given attribute should be considered for score calculation. - */ - for (i = 0; i < sizeof( attrib_match ) / sizeof( attrib_match[0] ); i++) { - if (attrib_match[i].attribute == attribute) { - ami = &attrib_match[i]; - break; - } - } - if (ami == NULL) - return TRUE; - - /* Iterate all pixelformats, query the requested attribute and calculate - * score points. - */ - for (index = 0; index < count; index++) { - int actual_value; - - if (!query_attrib( index + 1, 0, attribute, &actual_value )) - return FALSE; - - if (ami->exact) { - /* For an exact match criteria, if the actual and expected values differ, - * the score is set to 0 points, effectively removing the pixelformat - * from a list of matching pixelformats. - */ - if (actual_value != expected_value) - scores[index].points = 0; - } - else { - /* For a minimum match criteria, if the actual value is smaller than the expected - * value, the pixelformat is rejected (score set to 0). However, if the actual - * value is bigger, the pixelformat is given a penalty to favour pixelformats that - * more closely match the expected values. - */ - if (actual_value < expected_value) - scores[index].points = 0; - else if (actual_value > expected_value) - scores[index].points -= (actual_value - expected_value) * ami->weight; - } - } - - return TRUE; -} - -WINGDIAPI BOOL APIENTRY -wglChoosePixelFormatARB( - HDC hdc, - const int *piAttribIList, - const FLOAT *pfAttribFList, - UINT nMaxFormats, - int *piFormats, - UINT *nNumFormats ) -{ - uint count; - struct pixelformat_score *scores; - uint i; - - *nNumFormats = 0; - - /* Allocate and initialize pixelformat score table -- better matches - * have higher scores. Start with a high score and take out penalty - * points for a mismatch when the match does not have to be exact. - * Set a score to 0 if there is a mismatch for an exact match criteria. - */ - count = pixelformat_get_extended_count(); - scores = (struct pixelformat_score *) MALLOC( count * sizeof( struct pixelformat_score ) ); - if (scores == NULL) - return FALSE; - for (i = 0; i < count; i++) { - scores[i].points = 0x7fffffff; - scores[i].index = i; - } - - /* Given the attribute list calculate a score for each pixelformat. - */ - if (piAttribIList != NULL) { - while (*piAttribIList != 0) { - if (!score_pixelformats( scores, count, piAttribIList[0], piAttribIList[1] )) { - FREE( scores ); - return FALSE; - } - piAttribIList += 2; - } - } - if (pfAttribFList != NULL) { - while (*pfAttribFList != 0) { - if (!score_pixelformats( scores, count, (int) pfAttribFList[0], (int) pfAttribFList[1] )) { - FREE( scores ); - return FALSE; - } - pfAttribFList += 2; - } - } - - /* Bubble-sort the resulting scores. Pixelformats with higher scores go first. - * TODO: Find out if there are any patent issues with it. - */ - if (count > 1) { - uint n = count; - boolean swapped; - - do { - swapped = FALSE; - for (i = 1; i < n; i++) { - if (scores[i - 1].points < scores[i].points) { - struct pixelformat_score score = scores[i - 1]; - - scores[i - 1] = scores[i]; - scores[i] = score; - swapped = TRUE; - } - } - n--; - } - while (swapped); - } - - /* Return a list of pixelformats that are the best match. - * Reject pixelformats with non-positive scores. - */ - for (i = 0; i < count; i++) { - if (scores[i].points > 0) { - if (*nNumFormats < nMaxFormats) - piFormats[*nNumFormats] = scores[i].index + 1; - (*nNumFormats)++; - } - } - - FREE( scores ); - return TRUE; -} - -WINGDIAPI BOOL APIENTRY -wglGetPixelFormatAttribfvARB( - HDC hdc, - int iPixelFormat, - int iLayerPlane, - UINT nAttributes, - const int *piAttributes, - FLOAT *pfValues ) -{ - UINT i; - - (void) hdc; - - for (i = 0; i < nAttributes; i++) { - int value; - - if (!query_attrib( iPixelFormat, iLayerPlane, piAttributes[i], &value )) - return FALSE; - pfValues[i] = (FLOAT) value; - } - - return TRUE; -} - -WINGDIAPI BOOL APIENTRY -wglGetPixelFormatAttribivARB( - HDC hdc, - int iPixelFormat, - int iLayerPlane, - UINT nAttributes, - const int *piAttributes, - int *piValues ) -{ - UINT i; - - (void) hdc; - - for (i = 0; i < nAttributes; i++) { - if (!query_attrib( iPixelFormat, iLayerPlane, piAttributes[i], &piValues[i] )) - return FALSE; - } - - return TRUE; -} diff --git a/src/mesa/state_tracker/wgl/stw_wgl_arbpixelformat.h b/src/mesa/state_tracker/wgl/stw_wgl_arbpixelformat.h deleted file mode 100644 index 5e480b822b..0000000000 --- a/src/mesa/state_tracker/wgl/stw_wgl_arbpixelformat.h +++ /dev/null @@ -1,58 +0,0 @@ -/************************************************************************** - * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#ifndef WGL_ARBPIXELFORMAT_H -#define WGL_ARBPIXELFORMAT_H - -WINGDIAPI BOOL APIENTRY -wglChoosePixelFormatARB( - HDC hdc, - const int *piAttribIList, - const FLOAT *pfAttribFList, - UINT nMaxFormats, - int *piFormats, - UINT *nNumFormats ); - -WINGDIAPI BOOL APIENTRY -wglGetPixelFormatAttribfvARB( - HDC hdc, - int iPixelFormat, - int iLayerPlane, - UINT nAttributes, - const int *piAttributes, - FLOAT *pfValues ); - -WINGDIAPI BOOL APIENTRY -wglGetPixelFormatAttribivARB( - HDC hdc, - int iPixelFormat, - int iLayerPlane, - UINT nAttributes, - const int *piAttributes, - int *piValues ); - -#endif /* WGL_ARBPIXELFORMAT_H */ diff --git a/src/mesa/state_tracker/wgl/stw_wgl_context.c b/src/mesa/state_tracker/wgl/stw_wgl_context.c deleted file mode 100644 index 0c13c6b68a..0000000000 --- a/src/mesa/state_tracker/wgl/stw_wgl_context.c +++ /dev/null @@ -1,291 +0,0 @@ -/************************************************************************** - * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include <windows.h> - -#include "main/mtypes.h" -#include "main/context.h" -#include "pipe/p_compiler.h" -#include "pipe/p_context.h" -#include "state_tracker/st_context.h" -#include "state_tracker/st_public.h" -#include "stw_device.h" -#include "stw_winsys.h" -#include "stw_framebuffer.h" -#include "stw_pixelformat.h" -#include "stw_wgl_arbmultisample.h" -#include "stw_wgl_context.h" -#include "stw_wgl.h" - -static struct wgl_context *ctx_head = NULL; - -static HDC current_hdc = NULL; -static HGLRC current_hrc = NULL; - -WINGDIAPI BOOL APIENTRY -wglCopyContext( - HGLRC hglrcSrc, - HGLRC hglrcDst, - UINT mask ) -{ - (void) hglrcSrc; - (void) hglrcDst; - (void) mask; - - return FALSE; -} - -WINGDIAPI HGLRC APIENTRY -wglCreateContext( - HDC hdc ) -{ - uint pfi; - const struct pixelformat_info *pf; - struct wgl_context *ctx; - GLvisual *visual; - struct pipe_context *pipe; - - pfi = wglGetPixelFormat( hdc ); - if (pfi == 0) - return NULL; - - pf = pixelformat_get_info( pfi - 1 ); - - ctx = CALLOC_STRUCT( wgl_context ); - if (ctx == NULL) - return NULL; - - ctx->hdc = hdc; - ctx->color_bits = GetDeviceCaps( ctx->hdc, BITSPIXEL ); - - /* Create visual based on flags - */ - visual = _mesa_create_visual( - GL_TRUE, - (pf->flags & PF_FLAG_DOUBLEBUFFER) ? GL_TRUE : GL_FALSE, - GL_FALSE, - pf->color.redbits, - pf->color.greenbits, - pf->color.bluebits, - pf->alpha.alphabits, - 0, - pf->depth.depthbits, - pf->depth.stencilbits, - 0, - 0, - 0, - 0, - (pf->flags & PF_FLAG_MULTISAMPLED) ? wgl_query_samples() : 0 ); - if (visual == NULL) { - FREE( ctx ); - return NULL; - } - - pipe = stw_dev->stw_winsys->create_context( stw_dev->screen ); - if (!pipe) { - _mesa_destroy_visual( visual ); - FREE( ctx ); - return NULL; - } - - ctx->st = st_create_context( pipe, visual, NULL ); - if (ctx->st == NULL) { - pipe->destroy( pipe ); - _mesa_destroy_visual( visual ); - FREE( ctx ); - return NULL; - } - ctx->st->ctx->DriverCtx = ctx; - - ctx->next = ctx_head; - ctx_head = ctx; - - return (HGLRC) ctx; -} - -WINGDIAPI HGLRC APIENTRY -wglCreateLayerContext( - HDC hdc, - int iLayerPlane ) -{ - (void) hdc; - (void) iLayerPlane; - - return NULL; -} - -WINGDIAPI BOOL APIENTRY -wglDeleteContext( - HGLRC hglrc ) -{ - struct wgl_context **link = &ctx_head; - struct wgl_context *ctx = ctx_head; - - while (ctx != NULL) { - if (ctx == (struct wgl_context *) hglrc) { - GLcontext *glctx = ctx->st->ctx; - GET_CURRENT_CONTEXT( glcurctx ); - struct stw_framebuffer *fb; - - /* Unbind current if deleting current context. - */ - if (glcurctx == glctx) - st_make_current( NULL, NULL, NULL ); - - fb = framebuffer_from_hdc( ctx->hdc ); - if (fb) - framebuffer_destroy( fb ); - - if (WindowFromDC( ctx->hdc ) != NULL) - ReleaseDC( WindowFromDC( ctx->hdc ), ctx->hdc ); - - st_destroy_context( ctx->st ); - - *link = ctx->next; - FREE( ctx ); - return TRUE; - } - - link = &ctx->next; - ctx = ctx->next; - } - - return FALSE; -} - -/* Find the width and height of the window named by hdc. - */ -static void -get_window_size( HDC hdc, GLuint *width, GLuint *height ) -{ - if (WindowFromDC( hdc )) { - RECT rect; - - GetClientRect( WindowFromDC( hdc ), &rect ); - *width = rect.right - rect.left; - *height = rect.bottom - rect.top; - } - else { - *width = GetDeviceCaps( hdc, HORZRES ); - *height = GetDeviceCaps( hdc, VERTRES ); - } -} - -WINGDIAPI HGLRC APIENTRY -wglGetCurrentContext( VOID ) -{ - return current_hrc; -} - -WINGDIAPI HDC APIENTRY -wglGetCurrentDC( VOID ) -{ - return current_hdc; -} - -WINGDIAPI BOOL APIENTRY -wglMakeCurrent( - HDC hdc, - HGLRC hglrc ) -{ - struct wgl_context *ctx = ctx_head; - GET_CURRENT_CONTEXT( glcurctx ); - struct stw_framebuffer *fb; - GLuint width = 0; - GLuint height = 0; - - current_hdc = hdc; - current_hrc = hglrc; - - if (hdc == NULL || hglrc == NULL) { - st_make_current( NULL, NULL, NULL ); - return TRUE; - } - - while (ctx != NULL) { - if (ctx == (struct wgl_context *) hglrc) - break; - ctx = ctx->next; - } - if (ctx == NULL) - return FALSE; - - /* Return if already current. - */ - if (glcurctx != NULL) { - struct wgl_context *curctx = (struct wgl_context *) glcurctx->DriverCtx; - - if (curctx != NULL && curctx == ctx && ctx->hdc == hdc) - return TRUE; - } - - fb = framebuffer_from_hdc( hdc ); - - if (hdc != NULL) - get_window_size( hdc, &width, &height ); - - /* Lazy creation of framebuffers. - */ - if (fb == NULL && ctx != NULL && hdc != NULL) { - GLvisual *visual = &ctx->st->ctx->Visual; - - fb = framebuffer_create( hdc, visual, width, height ); - if (fb == NULL) - return FALSE; - - fb->dib_hDC = CreateCompatibleDC( hdc ); - fb->hbmDIB = NULL; - fb->pbPixels = NULL; - } - - if (ctx && fb) { - st_make_current( ctx->st, fb->stfb, fb->stfb ); - framebuffer_resize( fb, width, height ); - } - else { - /* Detach */ - st_make_current( NULL, NULL, NULL ); - } - - return TRUE; -} - -struct wgl_context * -wgl_context_from_hdc( - HDC hdc ) -{ - struct wgl_context *ctx = ctx_head; - - while (ctx != NULL) { - if (ctx->hdc == hdc) - return ctx; - ctx = ctx->next; - } - return NULL; -} - -#include "stw_wgl.c" diff --git a/src/mesa/state_tracker/wgl/stw_wgl_context.h b/src/mesa/state_tracker/wgl/stw_wgl_context.h deleted file mode 100644 index d87b3bdce2..0000000000 --- a/src/mesa/state_tracker/wgl/stw_wgl_context.h +++ /dev/null @@ -1,46 +0,0 @@ -/************************************************************************** - * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#ifndef WGL_CONTEXT_H -#define WGL_CONTEXT_H - -#include <windows.h> - -struct st_context; - -struct wgl_context -{ - struct st_context *st; - HDC hdc; - DWORD color_bits; - struct wgl_context *next; -}; - -struct wgl_context * -wgl_context_from_hdc(HDC hdc ); - -#endif /* WGL_CONTEXT_H */ diff --git a/src/mesa/state_tracker/wgl/stw_wgl_getprocaddress.c b/src/mesa/state_tracker/wgl/stw_wgl_getprocaddress.c deleted file mode 100644 index ec92d2dfce..0000000000 --- a/src/mesa/state_tracker/wgl/stw_wgl_getprocaddress.c +++ /dev/null @@ -1,70 +0,0 @@ -/************************************************************************** - * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include <windows.h> - -#include "glapi/glapi.h" -#include "stw_wgl_arbextensionsstring.h" -#include "stw_wgl_arbpixelformat.h" - -struct extension_entry -{ - const char *name; - PROC proc; -}; - -#define EXTENTRY(P) { #P, (PROC) P } - -static struct extension_entry extension_entries[] = { - - /* WGL_ARB_extensions_string */ - EXTENTRY( wglGetExtensionsStringARB ), - - /* WGL_ARB_pixel_format */ - EXTENTRY( wglChoosePixelFormatARB ), - EXTENTRY( wglGetPixelFormatAttribfvARB ), - EXTENTRY( wglGetPixelFormatAttribivARB ), - - { NULL, NULL } -}; - -WINGDIAPI PROC APIENTRY -wglGetProcAddress( - LPCSTR lpszProc ) -{ - struct extension_entry *entry; - - PROC p = (PROC) _glapi_get_proc_address( (const char *) lpszProc ); - if (p) - return p; - - for (entry = extension_entries; entry->name; entry++) - if (strcmp( lpszProc, entry->name ) == 0) - return entry->proc; - - return NULL; -} diff --git a/src/mesa/state_tracker/wgl/stw_wgl_pixelformat.c b/src/mesa/state_tracker/wgl/stw_wgl_pixelformat.c deleted file mode 100644 index 7a8a2e22e4..0000000000 --- a/src/mesa/state_tracker/wgl/stw_wgl_pixelformat.c +++ /dev/null @@ -1,187 +0,0 @@ -/************************************************************************** - * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include <windows.h> - -#include "pipe/p_compiler.h" -#include "pipe/p_debug.h" -#include "stw_pixelformat.h" -#include "stw_wgl.h" - -static uint currentpixelformat = 0; - -WINGDIAPI int APIENTRY -wglChoosePixelFormat( - HDC hdc, - CONST PIXELFORMATDESCRIPTOR *ppfd ) -{ - uint count; - uint index; - uint bestindex; - uint bestdelta; - - (void) hdc; - - count = pixelformat_get_count(); - bestindex = count; - bestdelta = 0xffffffff; - - if (ppfd->nSize != sizeof( PIXELFORMATDESCRIPTOR ) || ppfd->nVersion != 1) - return 0; - if (ppfd->iPixelType != PFD_TYPE_RGBA) - return 0; - if (!(ppfd->dwFlags & PFD_DRAW_TO_WINDOW)) - return 0; - if (!(ppfd->dwFlags & PFD_SUPPORT_OPENGL)) - return 0; - if (ppfd->dwFlags & PFD_DRAW_TO_BITMAP) - return 0; - if (ppfd->dwFlags & PFD_SUPPORT_GDI) - return 0; - if (!(ppfd->dwFlags & PFD_STEREO_DONTCARE) && (ppfd->dwFlags & PFD_STEREO)) - return 0; - - for (index = 0; index < count; index++) { - uint delta = 0; - const struct pixelformat_info *pf = pixelformat_get_info( index ); - - if (!(ppfd->dwFlags & PFD_DOUBLEBUFFER_DONTCARE)) { - if ((ppfd->dwFlags & PFD_DOUBLEBUFFER) && !(pf->flags & PF_FLAG_DOUBLEBUFFER)) - continue; - if (!(ppfd->dwFlags & PFD_DOUBLEBUFFER) && (pf->flags & PF_FLAG_DOUBLEBUFFER)) - continue; - } - - if (ppfd->cColorBits != pf->color.redbits + pf->color.greenbits + pf->color.bluebits) - delta += 8; - - if (ppfd->cDepthBits != pf->depth.depthbits) - delta += 4; - - if (ppfd->cStencilBits != pf->depth.stencilbits) - delta += 2; - - if (ppfd->cAlphaBits != pf->alpha.alphabits) - delta++; - - if (delta < bestdelta) { - bestindex = index; - bestdelta = delta; - if (bestdelta == 0) - break; - } - } - - if (bestindex == count) - return 0; - return bestindex + 1; -} - -WINGDIAPI int APIENTRY -wglDescribePixelFormat( - HDC hdc, - int iPixelFormat, - UINT nBytes, - LPPIXELFORMATDESCRIPTOR ppfd ) -{ - uint count; - uint index; - const struct pixelformat_info *pf; - - (void) hdc; - - count = pixelformat_get_extended_count(); - index = (uint) iPixelFormat - 1; - - if (ppfd == NULL) - return count; - if (index >= count || nBytes != sizeof( PIXELFORMATDESCRIPTOR )) - return 0; - - pf = pixelformat_get_info( index ); - - ppfd->nSize = sizeof( PIXELFORMATDESCRIPTOR ); - ppfd->nVersion = 1; - ppfd->dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL; - if (pf->flags & PF_FLAG_DOUBLEBUFFER) - ppfd->dwFlags |= PFD_DOUBLEBUFFER | PFD_SWAP_COPY; - ppfd->iPixelType = PFD_TYPE_RGBA; - ppfd->cColorBits = pf->color.redbits + pf->color.greenbits + pf->color.bluebits; - ppfd->cRedBits = pf->color.redbits; - ppfd->cRedShift = pf->color.redshift; - ppfd->cGreenBits = pf->color.greenbits; - ppfd->cGreenShift = pf->color.greenshift; - ppfd->cBlueBits = pf->color.bluebits; - ppfd->cBlueShift = pf->color.blueshift; - ppfd->cAlphaBits = pf->alpha.alphabits; - ppfd->cAlphaShift = pf->alpha.alphashift; - ppfd->cAccumBits = 0; - ppfd->cAccumRedBits = 0; - ppfd->cAccumGreenBits = 0; - ppfd->cAccumBlueBits = 0; - ppfd->cAccumAlphaBits = 0; - ppfd->cDepthBits = pf->depth.depthbits; - ppfd->cStencilBits = pf->depth.stencilbits; - ppfd->cAuxBuffers = 0; - ppfd->iLayerType = 0; - ppfd->bReserved = 0; - ppfd->dwLayerMask = 0; - ppfd->dwVisibleMask = 0; - ppfd->dwDamageMask = 0; - - return count; -} - -WINGDIAPI int APIENTRY -wglGetPixelFormat( - HDC hdc ) -{ - (void) hdc; - - return currentpixelformat; -} - -WINGDIAPI BOOL APIENTRY -wglSetPixelFormat( - HDC hdc, - int iPixelFormat, - const PIXELFORMATDESCRIPTOR *ppfd ) -{ - uint count; - uint index; - - (void) hdc; - - count = pixelformat_get_extended_count(); - index = (uint) iPixelFormat - 1; - - if (index >= count || ppfd->nSize != sizeof( PIXELFORMATDESCRIPTOR )) - return FALSE; - - currentpixelformat = index + 1; - return TRUE; -} diff --git a/src/mesa/state_tracker/wgl/stw_wgl_swapbuffers.c b/src/mesa/state_tracker/wgl/stw_wgl_swapbuffers.c deleted file mode 100644 index bd86501ac0..0000000000 --- a/src/mesa/state_tracker/wgl/stw_wgl_swapbuffers.c +++ /dev/null @@ -1,74 +0,0 @@ -/************************************************************************** - * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include <windows.h> - -#include "pipe/p_winsys.h" -#include "pipe/p_screen.h" -#include "pipe/p_context.h" -#include "state_tracker/st_context.h" -#include "state_tracker/st_public.h" -#include "stw_winsys.h" -#include "stw_device.h" -#include "stw_framebuffer.h" -#include "stw_wgl.h" - -WINGDIAPI BOOL APIENTRY -wglSwapBuffers( - HDC hdc ) -{ - struct stw_framebuffer *fb; - struct pipe_surface *surf; - - fb = framebuffer_from_hdc( hdc ); - if (fb == NULL) - return FALSE; - - /* If we're swapping the buffer associated with the current context - * we have to flush any pending rendering commands first. - */ - st_notify_swapbuffers( fb->stfb ); - - surf = st_get_framebuffer_surface( fb->stfb, ST_SURFACE_BACK_LEFT ); - - stw_dev->stw_winsys->flush_frontbuffer(stw_dev->screen->winsys, - surf, - hdc ); - - return TRUE; -} - -WINGDIAPI BOOL APIENTRY -wglSwapLayerBuffers( - HDC hdc, - UINT fuPlanes ) -{ - (void) hdc; - (void) fuPlanes; - - return FALSE; -} diff --git a/src/mesa/state_tracker/wgl/stw_winsys.h b/src/mesa/state_tracker/wgl/stw_winsys.h deleted file mode 100644 index 8557327ccd..0000000000 --- a/src/mesa/state_tracker/wgl/stw_winsys.h +++ /dev/null @@ -1,60 +0,0 @@ -/************************************************************************** - * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#ifndef STW_WINSYS_H -#define STW_WINSYS_H - -#include <windows.h> /* for HDC */ - -#include "pipe/p_compiler.h" - -struct pipe_screen; -struct pipe_context; -struct pipe_winsys; -struct pipe_surface; - -struct stw_winsys -{ - struct pipe_screen * - (*create_screen)( void ); - - struct pipe_context * - (*create_context)( struct pipe_screen *screen ); - - void - (*flush_frontbuffer)( struct pipe_winsys *winsys, - struct pipe_surface *surf, - HDC hDC ); -}; - -boolean -st_init(const struct stw_winsys *stw_winsys); - -void -st_cleanup(void); - -#endif /* STW_WINSYS_H */ |