X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fstate_tracker%2Fst_cb_drawtex.c;h=e6ab77fb521c4bb99025c9549a72cb5b94d27443;hb=c69ef377c8b30ee8d4088cfc586fe4100a5f0e62;hp=c4efce02f21b181d41b78dc0d423217c2527ce25;hpb=e45c969fe5890472d0a49bf2f7d561f3d315be2a;p=mesa.git diff --git a/src/mesa/state_tracker/st_cb_drawtex.c b/src/mesa/state_tracker/st_cb_drawtex.c index c4efce02f21..e6ab77fb521 100644 --- a/src/mesa/state_tracker/st_cb_drawtex.c +++ b/src/mesa/state_tracker/st_cb_drawtex.c @@ -1,6 +1,6 @@ /************************************************************************** * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. + * Copyright 2008 VMware, Inc. * All Rights Reserved. * **************************************************************************/ @@ -15,12 +15,13 @@ #include "main/imports.h" #include "main/image.h" #include "main/macros.h" -#include "main/mfeatures.h" +#include "main/teximage.h" #include "program/program.h" #include "program/prog_print.h" #include "st_context.h" #include "st_atom.h" +#include "st_cb_bitmap.h" #include "st_cb_drawtex.h" #include "pipe/p_context.h" @@ -92,7 +93,7 @@ lookup_shader(struct pipe_context *pipe, util_make_vertex_passthrough_shader(pipe, num_attribs, semantic_names, - semantic_indexes); + semantic_indexes, FALSE); NumCachedShaders++; return CachedShaders[i].handle; @@ -113,6 +114,8 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, struct pipe_vertex_element velements[2 + MAX_TEXTURE_UNITS]; unsigned offset; + st_flush_bitmap_cache(st); + st_validate_state(st); /* determine if we need vertex color */ @@ -124,7 +127,8 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, /* determine how many enabled sets of texcoords */ numTexCoords = 0; for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { - if (ctx->Texture.Unit[i]._ReallyEnabled & TEXTURE_2D_BIT) { + if (ctx->Texture.Unit[i]._Current && + ctx->Texture.Unit[i]._Current->Target == GL_TEXTURE_2D) { numTexCoords++; } } @@ -148,9 +152,10 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, GLfloat *vbuf = NULL; GLuint attr; - if (u_upload_alloc(st->uploader, 0, - numAttribs * 4 * 4 * sizeof(GLfloat), - &offset, &vbuffer, (void **) &vbuf) != PIPE_OK) { + u_upload_alloc(st->uploader, 0, + numAttribs * 4 * 4 * sizeof(GLfloat), 4, + &offset, &vbuffer, (void **) &vbuf); + if (!vbuffer) { return; } @@ -193,9 +198,10 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, /* texcoords */ for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { - if (ctx->Texture.Unit[i]._ReallyEnabled & TEXTURE_2D_BIT) { + if (ctx->Texture.Unit[i]._Current && + ctx->Texture.Unit[i]._Current->Target == GL_TEXTURE_2D) { struct gl_texture_object *obj = ctx->Texture.Unit[i]._Current; - struct gl_texture_image *img = obj->Image[0][obj->BaseLevel]; + const struct gl_texture_image *img = _mesa_base_tex_image(obj); const GLfloat wt = (GLfloat) img->Width; const GLfloat ht = (GLfloat) img->Height; const GLfloat s0 = obj->CropRect[0] / wt; @@ -227,6 +233,8 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, cso_save_viewport(cso); cso_save_stream_outputs(cso); cso_save_vertex_shader(cso); + cso_save_tessctrl_shader(cso); + cso_save_tesseval_shader(cso); cso_save_geometry_shader(cso); cso_save_vertex_elements(cso); cso_save_aux_vertex_buffer_slot(cso); @@ -236,6 +244,8 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, semantic_names, semantic_indexes); cso_set_vertex_shader_handle(cso, vs); } + cso_set_tessctrl_shader_handle(cso, NULL); + cso_set_tesseval_shader_handle(cso, NULL); cso_set_geometry_shader_handle(cso, NULL); for (i = 0; i < numAttribs; i++) { @@ -245,7 +255,7 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, velements[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT; } cso_set_vertex_elements(cso, numAttribs, velements); - cso_set_stream_outputs(st->cso_context, 0, NULL, 0); + cso_set_stream_outputs(st->cso_context, 0, NULL, NULL); /* viewport state: viewport matching window dims */ { @@ -257,11 +267,9 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, vp.scale[0] = 0.5f * width; vp.scale[1] = height * (invert ? -0.5f : 0.5f); vp.scale[2] = 1.0f; - vp.scale[3] = 1.0f; vp.translate[0] = 0.5f * width; vp.translate[1] = 0.5f * height; vp.translate[2] = 0.0f; - vp.translate[3] = 0.0f; cso_set_viewport(cso, &vp); } @@ -279,6 +287,8 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, /* restore state */ cso_restore_viewport(cso); cso_restore_vertex_shader(cso); + cso_restore_tessctrl_shader(cso); + cso_restore_tesseval_shader(cso); cso_restore_geometry_shader(cso); cso_restore_vertex_elements(cso); cso_restore_aux_vertex_buffer_slot(cso);