diff options
author | Michal Krol <michal@vmware.com> | 2009-12-12 16:48:32 +0100 |
---|---|---|
committer | Michal Krol <michal@vmware.com> | 2009-12-12 16:48:32 +0100 |
commit | a3eb0f718e19653a2ad8e49396c904183be456f3 (patch) | |
tree | 0092574c469ea586a6cab8b8ebb7ac62b8221a2a /src/mesa/main/texrender.c | |
parent | 491f384c3958067e6c4c994041f5d8d413b806bc (diff) | |
parent | 784cca9fa527de771754d76545970f78094b9adf (diff) |
Merge branch 'master' into glsl-pp-rework-2
Conflicts:
progs/perf/drawoverhead.c
progs/perf/teximage.c
progs/perf/vbo.c
progs/perf/vertexrate.c
src/mesa/shader/slang/library/slang_common_builtin_gc.h
Diffstat (limited to 'src/mesa/main/texrender.c')
-rw-r--r-- | src/mesa/main/texrender.c | 60 |
1 files changed, 33 insertions, 27 deletions
diff --git a/src/mesa/main/texrender.c b/src/mesa/main/texrender.c index cc74d58fbd..e2432be6ca 100644 --- a/src/mesa/main/texrender.c +++ b/src/mesa/main/texrender.c @@ -1,7 +1,8 @@ #include "context.h" +#include "colormac.h" #include "fbobject.h" -#include "texformat.h" +#include "texfetch.h" #include "texrender.h" #include "renderbuffer.h" @@ -46,7 +47,9 @@ texture_get_row(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, if (rb->DataType == CHAN_TYPE) { GLchan *rgbaOut = (GLchan *) values; for (i = 0; i < count; i++) { - trb->TexImage->FetchTexelc(trb->TexImage, x + i, y, z, rgbaOut + 4 * i); + GLfloat rgba[4]; + trb->TexImage->FetchTexelf(trb->TexImage, x + i, y, z, rgba); + UNCLAMPED_FLOAT_TO_RGBA_CHAN(rgbaOut + 4 * i, rgba); } } else if (rb->DataType == GL_UNSIGNED_SHORT) { @@ -100,8 +103,10 @@ texture_get_values(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, if (rb->DataType == CHAN_TYPE) { GLchan *rgbaOut = (GLchan *) values; for (i = 0; i < count; i++) { - trb->TexImage->FetchTexelc(trb->TexImage, x[i], y[i] + trb->Yoffset, - z, rgbaOut + 4 * i); + GLfloat rgba[4]; + trb->TexImage->FetchTexelf(trb->TexImage, x[i], y[i] + trb->Yoffset, + z, rgba); + UNCLAMPED_FLOAT_TO_RGBA_CHAN(rgbaOut + 4 * i, rgba); } } else if (rb->DataType == GL_UNSIGNED_SHORT) { @@ -398,6 +403,14 @@ texture_put_mono_values(GLcontext *ctx, struct gl_renderbuffer *rb, static void +store_nop(struct gl_texture_image *texImage, + GLint col, GLint row, GLint img, + const void *texel) +{ +} + + +static void delete_texture_wrapper(struct gl_renderbuffer *rb) { ASSERT(rb->RefCount == 0); @@ -454,6 +467,7 @@ update_wrapper(GLcontext *ctx, const struct gl_renderbuffer_attachment *att) { struct texture_renderbuffer *trb = (struct texture_renderbuffer *) att->Renderbuffer; + gl_format texFormat; (void) ctx; ASSERT(trb); @@ -461,8 +475,11 @@ update_wrapper(GLcontext *ctx, const struct gl_renderbuffer_attachment *att) trb->TexImage = att->Texture->Image[att->CubeMapFace][att->TextureLevel]; ASSERT(trb->TexImage); - trb->Store = trb->TexImage->TexFormat->StoreTexel; - ASSERT(trb->Store); + trb->Store = _mesa_get_texel_store_func(trb->TexImage->TexFormat); + if (!trb->Store) { + /* we'll never draw into some textures (compressed formats) */ + trb->Store = store_nop; + } if (att->Texture->Target == GL_TEXTURE_1D_ARRAY_EXT) { trb->Yoffset = att->Zoffset; @@ -473,41 +490,30 @@ update_wrapper(GLcontext *ctx, const struct gl_renderbuffer_attachment *att) trb->Zoffset = att->Zoffset; } + texFormat = trb->TexImage->TexFormat; + trb->Base.Width = trb->TexImage->Width; trb->Base.Height = trb->TexImage->Height; trb->Base.InternalFormat = trb->TexImage->InternalFormat; /* XXX may need more special cases here */ - if (trb->TexImage->TexFormat->MesaFormat == MESA_FORMAT_Z24_S8) { - trb->Base._ActualFormat = GL_DEPTH24_STENCIL8_EXT; + if (trb->TexImage->TexFormat == MESA_FORMAT_Z24_S8) { + trb->Base.Format = MESA_FORMAT_Z24_S8; trb->Base.DataType = GL_UNSIGNED_INT_24_8_EXT; } - else if (trb->TexImage->TexFormat->MesaFormat == MESA_FORMAT_Z16) { - trb->Base._ActualFormat = GL_DEPTH_COMPONENT; + else if (trb->TexImage->TexFormat == MESA_FORMAT_Z16) { + trb->Base.Format = MESA_FORMAT_Z16; trb->Base.DataType = GL_UNSIGNED_SHORT; } - else if (trb->TexImage->TexFormat->MesaFormat == MESA_FORMAT_Z32) { - trb->Base._ActualFormat = GL_DEPTH_COMPONENT; + else if (trb->TexImage->TexFormat == MESA_FORMAT_Z32) { + trb->Base.Format = MESA_FORMAT_Z32; trb->Base.DataType = GL_UNSIGNED_INT; } else { - trb->Base._ActualFormat = trb->TexImage->InternalFormat; + trb->Base.Format = trb->TexImage->TexFormat; trb->Base.DataType = CHAN_TYPE; } - trb->Base._BaseFormat = trb->TexImage->TexFormat->BaseFormat; -#if 0 - /* fix/avoid this assertion someday */ - ASSERT(trb->Base._BaseFormat == GL_RGB || - trb->Base._BaseFormat == GL_RGBA || - trb->Base._BaseFormat == GL_DEPTH_COMPONENT); -#endif trb->Base.Data = trb->TexImage->Data; - - trb->Base.RedBits = trb->TexImage->TexFormat->RedBits; - trb->Base.GreenBits = trb->TexImage->TexFormat->GreenBits; - trb->Base.BlueBits = trb->TexImage->TexFormat->BlueBits; - trb->Base.AlphaBits = trb->TexImage->TexFormat->AlphaBits; - trb->Base.DepthBits = trb->TexImage->TexFormat->DepthBits; - trb->Base.StencilBits = trb->TexImage->TexFormat->StencilBits; + trb->Base._BaseFormat = _mesa_base_fbo_format(ctx, trb->Base.InternalFormat); } |