X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fswrast%2Fs_context.h;h=7cf0e30dc30857e89d1fd5bb1320225a7ea2f8c2;hb=03c4171b577b06b1d8dde50b6eb9507d8ef4c1ce;hp=f03f0485bcddbb1fa259dc97650b492c0d85db56;hpb=34988272d9c7a889a26bb8bdcb841d44797a5dd6;p=mesa.git diff --git a/src/mesa/swrast/s_context.h b/src/mesa/swrast/s_context.h index f03f0485bcd..7cf0e30dc30 100644 --- a/src/mesa/swrast/s_context.h +++ b/src/mesa/swrast/s_context.h @@ -1,6 +1,5 @@ /* * Mesa 3-D graphics library - * Version: 6.5.3 * * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. * @@ -17,16 +16,17 @@ * 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 NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL 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. + * THE AUTHORS OR COPYRIGHT HOLDERS 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 swrast/s_context.h * \brief Software rasterization context and private types. - * \author Keith Whitwell + * \author Keith Whitwell */ /** @@ -45,20 +45,23 @@ #include "main/compiler.h" #include "main/mtypes.h" +#include "main/texcompress.h" #include "program/prog_execute.h" #include "swrast.h" +#include "s_fragprog.h" #include "s_span.h" typedef void (*texture_sample_func)(struct gl_context *ctx, + const struct gl_sampler_object *samp, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat rgba[][4]); -typedef void (_ASMAPIP blend_func)( struct gl_context *ctx, GLuint n, - const GLubyte mask[], - GLvoid *src, const GLvoid *dst, - GLenum chanType); +typedef void (*blend_func)(struct gl_context *ctx, GLuint n, + const GLubyte mask[], + GLvoid *src, const GLvoid *dst, + GLenum chanType); typedef void (*swrast_point_func)( struct gl_context *ctx, const SWvertex *); @@ -120,14 +123,10 @@ typedef void (*FetchTexelFunc)(const struct swrast_texture_image *texImage, GLfloat *texelOut); -typedef void (*StoreTexelFunc)(struct swrast_texture_image *texImage, - GLint col, GLint row, GLint img, - const void *texel); - /** * Subclass of gl_texture_image. * We need extra fields/info to keep tracking of mapped texture buffers, - * strides and Fetch/Store functions. + * strides and Fetch functions. */ struct swrast_texture_image { @@ -138,17 +137,32 @@ struct swrast_texture_image /** used for mipmap LOD computation */ GLfloat WidthScale, HeightScale, DepthScale; - /** These fields only valid when texture memory is mapped */ - GLint RowStride; /**< Padded width in units of texels */ - GLuint *ImageOffsets; /**< if 3D texture: array [Depth] of offsets to - each 2D slice in 'Data', in texels */ - GLubyte *Map; /**< Pointer to mapped image memory */ + /** + * Byte stride between rows in ImageSlices. + * + * For compressed textures, this is the byte stride between one row of + * blocks and the next row of blocks. + * + * Only valid while one of the ImageSlices is mapped, and must be the same + * between all slices. + */ + GLint RowStride; + /** + * When a texture image is mapped for swrast, this array contains pointers + * to the beginning of each slice. + * + * For swrast-allocated textures, these pointers will always stay + * initialized to point within Buffer. + */ + void **ImageSlices; /** Malloc'd texture memory */ GLubyte *Buffer; FetchTexelFunc FetchTexel; - StoreTexelFunc Store; + + /** For fetching texels from compressed textures */ + compressed_fetch_func FetchCompressedTexel; }; @@ -180,6 +194,9 @@ struct swrast_renderbuffer /** These fields are only valid while buffer is mapped for rendering */ GLubyte *Map; GLint RowStride; /**< in bytes */ + + /** For span rendering */ + GLenum ColorType; }; @@ -220,13 +237,13 @@ typedef struct GLboolean _DeferredTexture; /** List/array of the fragment attributes to interpolate */ - GLuint _ActiveAttribs[FRAG_ATTRIB_MAX]; - /** Same info, but as a bitmask of FRAG_BIT_x bits */ + GLuint _ActiveAttribs[VARYING_SLOT_MAX]; + /** Same info, but as a bitmask of VARYING_BIT_x bits */ GLbitfield64 _ActiveAttribMask; /** Number of fragment attributes to interpolate */ GLuint _NumActiveAttribs; /** Indicates how each attrib is to be interpolated (lines/tris) */ - GLenum _InterpMode[FRAG_ATTRIB_MAX]; /* GL_FLAT or GL_SMOOTH (for now) */ + GLenum _InterpMode[VARYING_SLOT_MAX]; /* GL_FLAT or GL_SMOOTH (for now) */ /* Working values: */ @@ -295,7 +312,7 @@ typedef struct /** Internal hooks, kept up to date by the same mechanism as above. */ blend_func BlendFunc; - texture_sample_func TextureSample[MAX_TEXTURE_IMAGE_UNITS]; + texture_sample_func TextureSample[MAX_COMBINED_TEXTURE_IMAGE_UNITS]; /** Buffer for saving the sampled texture colors. * Needed for GL_ARB_texture_env_crossbar implementation. @@ -307,6 +324,13 @@ typedef struct /** State used during execution of fragment programs */ struct gl_program_machine FragProgMachine; + /** Temporary arrays for stencil operations. To avoid large stack + * allocations. + */ + struct { + GLubyte *buf1, *buf2, *buf3, *buf4; + } stencil_temp; + } SWcontext; @@ -368,6 +392,9 @@ _swrast_map_textures(struct gl_context *ctx); extern void _swrast_unmap_textures(struct gl_context *ctx); +extern unsigned int +_swrast_teximage_slice_height(struct gl_texture_image *texImage); + extern void _swrast_map_texture(struct gl_context *ctx, struct gl_texture_object *texObj); @@ -453,8 +480,9 @@ _swrast_unmap_renderbuffers(struct gl_context *ctx); static inline GLubyte * _swrast_pixel_address(struct gl_renderbuffer *rb, GLint x, GLint y) { + struct swrast_renderbuffer *srb = swrast_renderbuffer(rb); const GLint bpp = _mesa_get_format_bytes(rb->Format); - const GLint rowStride = rb->RowStrideBytes; + const GLint rowStride = srb->RowStride; assert(x >= 0); assert(y >= 0); /* NOTE: using <= only because of s_tritemp.h which gets a pixel @@ -462,8 +490,8 @@ _swrast_pixel_address(struct gl_renderbuffer *rb, GLint x, GLint y) */ assert(x <= (GLint) rb->Width); assert(y <= (GLint) rb->Height); - assert(rb->Map); - return (GLubyte *) rb->Map + y * rowStride + x * bpp; + assert(srb->Map); + return (GLubyte *) srb->Map + y * rowStride + x * bpp; }