The removed files have no user. Signed-off-by: Chia-I Wu <olvaffe@gmail.com> Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org> Reviewed-by: Ryan Neph <ryanneph@google.com> Acked-by: Gert Wollny <gert.wollny@collabora.com> v2: u_bitmask.* is unused as wellmacos/master
parent
e7cf972d8b
commit
f720e2497e
@ -1,87 +0,0 @@ |
||||
/**************************************************************************
|
||||
* |
||||
* Copyright 2011 LunarG, 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. |
||||
* |
||||
**************************************************************************/ |
||||
|
||||
/**
|
||||
* @file |
||||
* OS independent memory mapping (with large file support). |
||||
* |
||||
* @author Chia-I Wu <olvaffe@gmail.com> |
||||
*/ |
||||
|
||||
#ifndef _OS_MMAN_H_ |
||||
#define _OS_MMAN_H_ |
||||
|
||||
|
||||
#include "pipe/p_config.h" |
||||
#include "pipe/p_compiler.h" |
||||
|
||||
#if defined(PIPE_OS_UNIX) |
||||
# ifndef _FILE_OFFSET_BITS |
||||
# error _FILE_OFFSET_BITS must be defined to 64 |
||||
# endif |
||||
# include <sys/mman.h> |
||||
#else |
||||
# error Unsupported OS |
||||
#endif |
||||
|
||||
#if defined(PIPE_OS_ANDROID) |
||||
# include <errno.h> /* for EINVAL */ |
||||
#endif |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
#if defined(PIPE_OS_ANDROID) |
||||
|
||||
extern void *__mmap2(void *, size_t, int, int, int, size_t); |
||||
|
||||
static inline void *os_mmap(void *addr, size_t length, int prot, int flags, int fd, loff_t offset) |
||||
{ |
||||
/* offset must be aligned to 4096 (not necessarily the page size) */ |
||||
if (unlikely(offset & 4095)) { |
||||
errno = EINVAL; |
||||
return MAP_FAILED; |
||||
} |
||||
|
||||
return __mmap2(addr, length, prot, flags, fd, (size_t) (offset >> 12)); |
||||
} |
||||
|
||||
#else |
||||
/* assume large file support exists */ |
||||
# define os_mmap(addr, length, prot, flags, fd, offset) mmap(addr, length, prot, flags, fd, offset) |
||||
#endif |
||||
|
||||
#define os_munmap(addr, length) munmap(addr, length) |
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} |
||||
#endif |
||||
|
||||
#endif /* _OS_MMAN_H_ */ |
@ -1,218 +0,0 @@ |
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2008 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 OP12_TEX |
||||
#define OP12_TEX(a) OP12(a) |
||||
#endif |
||||
|
||||
#ifndef OP14_TEX |
||||
#define OP14_TEX(a) OP14(a) |
||||
#endif |
||||
|
||||
#ifndef OP12_SAMPLE |
||||
#define OP12_SAMPLE(a) OP12(a) |
||||
#endif |
||||
|
||||
#ifndef OP13_SAMPLE |
||||
#define OP13_SAMPLE(a) OP13(a) |
||||
#endif |
||||
|
||||
#ifndef OP14_SAMPLE |
||||
#define OP14_SAMPLE(a) OP14(a) |
||||
#endif |
||||
|
||||
#ifndef OP15_SAMPLE |
||||
#define OP15_SAMPLE(a) OP15(a) |
||||
#endif |
||||
|
||||
#ifndef OP00_LBL |
||||
#define OP00_LBL(a) OP00(a) |
||||
#endif |
||||
|
||||
#ifndef OP01_LBL |
||||
#define OP01_LBL(a) OP01(a) |
||||
#endif |
||||
|
||||
OP11(ARL) |
||||
OP11(MOV) |
||||
OP11(LIT) |
||||
OP11(RCP) |
||||
OP11(RSQ) |
||||
OP11(EXP) |
||||
OP11(LOG) |
||||
OP12(MUL) |
||||
OP12(ADD) |
||||
OP12(DP3) |
||||
OP12(DP4) |
||||
OP12(DST) |
||||
OP12(MIN) |
||||
OP12(MAX) |
||||
OP12(SLT) |
||||
OP12(SGE) |
||||
OP13(MAD) |
||||
OP12(SUB) |
||||
OP13(LRP) |
||||
OP11(SQRT) |
||||
OP11(FRC) |
||||
OP11(FLR) |
||||
OP11(ROUND) |
||||
OP11(EX2) |
||||
OP11(LG2) |
||||
OP12(POW) |
||||
OP12(XPD) |
||||
OP11(ABS) |
||||
OP12(DPH) |
||||
OP11(COS) |
||||
OP11(DDX) |
||||
OP11(DDY) |
||||
OP00(KILL) |
||||
OP11(PK2H) |
||||
OP11(PK2US) |
||||
OP11(PK4B) |
||||
OP11(PK4UB) |
||||
OP12(SEQ) |
||||
OP12(SGT) |
||||
OP11(SIN) |
||||
OP12(SLE) |
||||
OP12(SNE) |
||||
OP12_TEX(TEX) |
||||
OP14_TEX(TXD) |
||||
OP12_TEX(TXP) |
||||
OP11(UP2H) |
||||
OP11(UP2US) |
||||
OP11(UP4B) |
||||
OP11(UP4UB) |
||||
OP11(ARR) |
||||
OP00_LBL(CAL) |
||||
OP00(RET) |
||||
OP11(SSG) |
||||
OP13(CMP) |
||||
OP11(SCS) |
||||
OP12_TEX(TXB) |
||||
OP12(DIV) |
||||
OP12(DP2) |
||||
OP12_TEX(TXL) |
||||
OP00(BRK) |
||||
OP01_LBL(IF) |
||||
OP01_LBL(UIF) |
||||
OP00_LBL(ELSE) |
||||
OP00(ENDIF) |
||||
OP11(CEIL) |
||||
OP11(I2F) |
||||
OP11(NOT) |
||||
OP11(TRUNC) |
||||
OP12(SHL) |
||||
OP12(AND) |
||||
OP12(OR) |
||||
OP12(MOD) |
||||
OP12(XOR) |
||||
OP12_TEX(TXF) |
||||
OP12_TEX(TXQ) |
||||
OP00(CONT) |
||||
OP01(EMIT) |
||||
OP01(ENDPRIM) |
||||
OP00_LBL(BGNLOOP) |
||||
OP00(BGNSUB) |
||||
OP00_LBL(ENDLOOP) |
||||
OP00(ENDSUB) |
||||
OP00(NOP) |
||||
OP01(KILL_IF) |
||||
OP00(END) |
||||
OP11(F2I) |
||||
OP12(FSEQ) |
||||
OP12(FSGE) |
||||
OP12(FSLT) |
||||
OP12(FSNE) |
||||
OP12(IDIV) |
||||
OP12(IMAX) |
||||
OP12(IMIN) |
||||
OP11(INEG) |
||||
OP12(ISGE) |
||||
OP12(ISHR) |
||||
OP12(ISLT) |
||||
OP11(F2U) |
||||
OP11(U2F) |
||||
OP12(UADD) |
||||
OP12(UDIV) |
||||
OP13(UMAD) |
||||
OP12(UMAX) |
||||
OP12(UMIN) |
||||
OP12(UMOD) |
||||
OP12(UMUL) |
||||
OP12(USEQ) |
||||
OP12(USGE) |
||||
OP12(USHR) |
||||
OP12(USLT) |
||||
OP12(USNE) |
||||
OP01(SWITCH) |
||||
OP01(CASE) |
||||
OP00(DEFAULT) |
||||
OP00(ENDSWITCH) |
||||
|
||||
OP13_SAMPLE(SAMPLE) |
||||
OP12_SAMPLE(SAMPLE_I) |
||||
OP13_SAMPLE(SAMPLE_I_MS) |
||||
OP14_SAMPLE(SAMPLE_B) |
||||
OP14_SAMPLE(SAMPLE_C) |
||||
OP14_SAMPLE(SAMPLE_C_LZ) |
||||
OP15_SAMPLE(SAMPLE_D) |
||||
OP14_SAMPLE(SAMPLE_L) |
||||
OP13_SAMPLE(GATHER4) |
||||
OP12(SVIEWINFO) |
||||
OP13(SAMPLE_POS) |
||||
OP12(SAMPLE_INFO) |
||||
OP11(UARL) |
||||
|
||||
OP13(UCMP) |
||||
|
||||
OP12(IMUL_HI) |
||||
OP12(UMUL_HI) |
||||
|
||||
#undef OP00 |
||||
#undef OP01 |
||||
#undef OP10 |
||||
#undef OP11 |
||||
#undef OP12 |
||||
#undef OP13 |
||||
|
||||
#ifdef OP14 |
||||
#undef OP14 |
||||
#endif |
||||
|
||||
#ifdef OP15 |
||||
#undef OP15 |
||||
#endif |
||||
|
||||
#undef OP00_LBL |
||||
#undef OP01_LBL |
||||
|
||||
#undef OP12_TEX |
||||
#undef OP14_TEX |
||||
|
||||
#undef OP12_SAMPLE |
||||
#undef OP13_SAMPLE |
||||
#undef OP14_SAMPLE |
||||
#undef OP15_SAMPLE |
@ -1,250 +0,0 @@ |
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2008 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. |
||||
*
|
||||
**************************************************************************/ |
||||
|
||||
/**
|
||||
* TGSI program transformation utility. |
||||
* |
||||
* Authors: Brian Paul |
||||
*/ |
||||
|
||||
#include "util/u_debug.h" |
||||
|
||||
#include "tgsi_transform.h" |
||||
|
||||
|
||||
|
||||
static void |
||||
emit_instruction(struct tgsi_transform_context *ctx, |
||||
const struct tgsi_full_instruction *inst) |
||||
{ |
||||
uint ti = ctx->ti; |
||||
|
||||
ti += tgsi_build_full_instruction(inst, |
||||
ctx->tokens_out + ti, |
||||
ctx->header, |
||||
ctx->max_tokens_out - ti); |
||||
ctx->ti = ti; |
||||
} |
||||
|
||||
|
||||
static void |
||||
emit_declaration(struct tgsi_transform_context *ctx, |
||||
const struct tgsi_full_declaration *decl) |
||||
{ |
||||
uint ti = ctx->ti; |
||||
|
||||
ti += tgsi_build_full_declaration(decl, |
||||
ctx->tokens_out + ti, |
||||
ctx->header, |
||||
ctx->max_tokens_out - ti); |
||||
ctx->ti = ti; |
||||
} |
||||
|
||||
|
||||
static void |
||||
emit_immediate(struct tgsi_transform_context *ctx, |
||||
const struct tgsi_full_immediate *imm) |
||||
{ |
||||
uint ti = ctx->ti; |
||||
|
||||
ti += tgsi_build_full_immediate(imm, |
||||
ctx->tokens_out + ti, |
||||
ctx->header, |
||||
ctx->max_tokens_out - ti); |
||||
ctx->ti = ti; |
||||
} |
||||
|
||||
|
||||
static void |
||||
emit_property(struct tgsi_transform_context *ctx, |
||||
const struct tgsi_full_property *prop) |
||||
{ |
||||
uint ti = ctx->ti; |
||||
|
||||
ti += tgsi_build_full_property(prop, |
||||
ctx->tokens_out + ti, |
||||
ctx->header, |
||||
ctx->max_tokens_out - ti); |
||||
ctx->ti = ti; |
||||
} |
||||
|
||||
|
||||
/**
|
||||
* Apply user-defined transformations to the input shader to produce |
||||
* the output shader. |
||||
* For example, a register search-and-replace operation could be applied |
||||
* by defining a transform_instruction() callback that examined and changed |
||||
* the instruction src/dest regs. |
||||
* |
||||
* \return number of tokens emitted |
||||
*/ |
||||
int |
||||
tgsi_transform_shader(const struct tgsi_token *tokens_in, |
||||
struct tgsi_token *tokens_out, |
||||
uint max_tokens_out, |
||||
struct tgsi_transform_context *ctx) |
||||
{ |
||||
uint procType; |
||||
|
||||
/* input shader */ |
||||
struct tgsi_parse_context parse; |
||||
|
||||
/* output shader */ |
||||
struct tgsi_processor *processor; |
||||
|
||||
|
||||
/**
|
||||
** callback context init |
||||
**/ |
||||
ctx->emit_instruction = emit_instruction; |
||||
ctx->emit_declaration = emit_declaration; |
||||
ctx->emit_immediate = emit_immediate; |
||||
ctx->emit_property = emit_property; |
||||
ctx->tokens_out = tokens_out; |
||||
ctx->max_tokens_out = max_tokens_out; |
||||
|
||||
|
||||
/**
|
||||
** Setup to begin parsing input shader |
||||
**/ |
||||
if (tgsi_parse_init( &parse, tokens_in ) != TGSI_PARSE_OK) { |
||||
debug_printf("tgsi_parse_init() failed in tgsi_transform_shader()!\n"); |
||||
return -1; |
||||
} |
||||
procType = parse.FullHeader.Processor.Processor; |
||||
assert(procType == TGSI_PROCESSOR_FRAGMENT || |
||||
procType == TGSI_PROCESSOR_VERTEX || |
||||
procType == TGSI_PROCESSOR_GEOMETRY); |
||||
|
||||
|
||||
/**
|
||||
** Setup output shader |
||||
**/ |
||||
ctx->header = (struct tgsi_header *)tokens_out; |
||||
*ctx->header = tgsi_build_header(); |
||||
|
||||
processor = (struct tgsi_processor *) (tokens_out + 1); |
||||
*processor = tgsi_build_processor( procType, ctx->header ); |
||||
|
||||
ctx->ti = 2; |
||||
|
||||
|
||||
/**
|
||||
** Loop over incoming program tokens/instructions |
||||
*/ |
||||
while( !tgsi_parse_end_of_tokens( &parse ) ) { |
||||
|
||||
tgsi_parse_token( &parse ); |
||||
|
||||
switch( parse.FullToken.Token.Type ) { |
||||
case TGSI_TOKEN_TYPE_INSTRUCTION: |
||||
{ |
||||
struct tgsi_full_instruction *fullinst |
||||
= &parse.FullToken.FullInstruction; |
||||
|
||||
if (ctx->transform_instruction) |
||||
ctx->transform_instruction(ctx, fullinst); |
||||
else |
||||
ctx->emit_instruction(ctx, fullinst); |
||||
} |
||||
break; |
||||
|
||||
case TGSI_TOKEN_TYPE_DECLARATION: |
||||
{ |
||||
struct tgsi_full_declaration *fulldecl |
||||
= &parse.FullToken.FullDeclaration; |
||||
|
||||
if (ctx->transform_declaration) |
||||
ctx->transform_declaration(ctx, fulldecl); |
||||
else |
||||
ctx->emit_declaration(ctx, fulldecl); |
||||
} |
||||
break; |
||||
|
||||
case TGSI_TOKEN_TYPE_IMMEDIATE: |
||||
{ |
||||
struct tgsi_full_immediate *fullimm |
||||
= &parse.FullToken.FullImmediate; |
||||
|
||||
if (ctx->transform_immediate) |
||||
ctx->transform_immediate(ctx, fullimm); |
||||
else |
||||
ctx->emit_immediate(ctx, fullimm); |
||||
} |
||||
break; |
||||
case TGSI_TOKEN_TYPE_PROPERTY: |
||||
{ |
||||
struct tgsi_full_property *fullprop |
||||
= &parse.FullToken.FullProperty; |
||||
|
||||
if (ctx->transform_property) |
||||
ctx->transform_property(ctx, fullprop); |
||||
else |
||||
ctx->emit_property(ctx, fullprop); |
||||
} |
||||
break; |
||||
|
||||
default: |
||||
assert( 0 ); |
||||
} |
||||
} |
||||
|
||||
if (ctx->epilog) { |
||||
ctx->epilog(ctx); |
||||
} |
||||
|
||||
tgsi_parse_free (&parse); |
||||
|
||||
return ctx->ti; |
||||
} |
||||
|
||||
|
||||
#include "tgsi_text.h" |
||||
|
||||
extern int tgsi_transform_foo( struct tgsi_token *tokens_out, |
||||
uint max_tokens_out ); |
||||
|
||||
/* This function exists only so that tgsi_text_translate() doesn't get
|
||||
* magic-ed out of the libtgsi.a archive by the build system. Don't |
||||
* remove unless you know this has been fixed - check on mingw/scons |
||||
* builds as well. |
||||
*/ |
||||
int |
||||
tgsi_transform_foo( struct tgsi_token *tokens_out, |
||||
uint max_tokens_out ) |
||||
{ |
||||
const char *text =
|
||||
"FRAG\n" |
||||
"DCL IN[0], COLOR, CONSTANT\n" |
||||
"DCL OUT[0], COLOR\n" |
||||
" 0: MOV OUT[0], IN[0]\n" |
||||
" 1: END"; |
||||
|
||||
return tgsi_text_translate( text, |
||||
tokens_out, |
||||
max_tokens_out ); |
||||
} |
@ -1,96 +0,0 @@ |
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2008 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 TGSI_TRANSFORM_H |
||||
#define TGSI_TRANSFORM_H |
||||
|
||||
|
||||
#include "pipe/p_shader_tokens.h" |
||||
#include "tgsi/tgsi_parse.h" |
||||
#include "tgsi/tgsi_build.h" |
||||
|
||||
|
||||
|
||||
/**
|
||||
* Subclass this to add caller-specific data |
||||
*/ |
||||
struct tgsi_transform_context |
||||
{ |
||||
/**** PUBLIC ***/ |
||||
|
||||
/**
|
||||
* User-defined callbacks invoked per instruction. |
||||
*/ |
||||
void (*transform_instruction)(struct tgsi_transform_context *ctx, |
||||
struct tgsi_full_instruction *inst); |
||||
|
||||
void (*transform_declaration)(struct tgsi_transform_context *ctx, |
||||
struct tgsi_full_declaration *decl); |
||||
|
||||
void (*transform_immediate)(struct tgsi_transform_context *ctx, |
||||
struct tgsi_full_immediate *imm); |
||||
void (*transform_property)(struct tgsi_transform_context *ctx, |
||||
struct tgsi_full_property *prop); |
||||
|
||||
/**
|
||||
* Called at end of input program to allow caller to append extra |
||||
* instructions. Return number of tokens emitted. |
||||
*/ |
||||
void (*epilog)(struct tgsi_transform_context *ctx); |
||||
|
||||
|
||||
/*** PRIVATE ***/ |
||||
|
||||
/**
|
||||
* These are setup by tgsi_transform_shader() and cannot be overridden. |
||||
* Meant to be called from in the above user callback functions. |
||||
*/ |
||||
void (*emit_instruction)(struct tgsi_transform_context *ctx, |
||||
const struct tgsi_full_instruction *inst); |
||||
void (*emit_declaration)(struct tgsi_transform_context *ctx, |
||||
const struct tgsi_full_declaration *decl); |
||||
void (*emit_immediate)(struct tgsi_transform_context *ctx, |
||||
const struct tgsi_full_immediate *imm); |
||||
void (*emit_property)(struct tgsi_transform_context *ctx, |
||||
const struct tgsi_full_property *prop); |
||||
|
||||
struct tgsi_header *header; |
||||
uint max_tokens_out; |
||||
struct tgsi_token *tokens_out; |
||||
uint ti; |
||||
}; |
||||
|
||||
|
||||
|
||||
extern int |
||||
tgsi_transform_shader(const struct tgsi_token *tokens_in, |
||||
struct tgsi_token *tokens_out, |
||||
uint max_tokens_out, |
||||
struct tgsi_transform_context *ctx); |
||||
|
||||
|
||||
#endif /* TGSI_TRANSFORM_H */ |
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,61 +0,0 @@ |
||||
/*
|
||||
* Copyright (C) 2011 Red Hat Inc. |
||||
*
|
||||
* block compression parts are: |
||||
* Copyright (C) 2004 Roland Scheidegger 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, sublicense, |
||||
* 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 NONINFRINGEMENT. IN NO EVENT SHALL |
||||
* 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. |
||||
* |
||||
* Author: |
||||
* Dave Airlie |
||||
*/ |
||||
|
||||
#include <inttypes.h> |
||||
#include "macros.h" |
||||
|
||||
#include "rgtc.h" |
||||
|
||||
#define RGTC_DEBUG 0 |
||||
|
||||
#define TAG(x) util_format_unsigned_##x |
||||
|
||||
#define TYPE unsigned char |
||||
#define T_MIN 0 |
||||
#define T_MAX 0xff |
||||
|
||||
#include "texcompress_rgtc_tmp.h" |
||||
|
||||
#undef TAG |
||||
#undef TYPE |
||||
#undef T_MIN |
||||
#undef T_MAX |
||||
|
||||
#define TAG(x) util_format_signed_##x |
||||
#define TYPE signed char |
||||
#define T_MIN (signed char)-128 |
||||
#define T_MAX (signed char)127 |
||||
|
||||
#include "texcompress_rgtc_tmp.h" |
||||
|
||||
#undef TAG |
||||
#undef TYPE |
||||
#undef T_MIN |
||||
#undef T_MAX |
||||
|
@ -1,39 +0,0 @@ |
||||
/*
|
||||
* Copyright © 2014 Red Hat |
||||
* |
||||
* 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, sublicense, |
||||
* 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 NONINFRINGEMENT. IN NO EVENT SHALL |
||||
* 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. |
||||
* |
||||
*/ |
||||
|
||||
#ifndef _RGTC_H |
||||
#define _RGTC_H |
||||
|
||||
void util_format_unsigned_fetch_texel_rgtc(unsigned srcRowStride, const unsigned char *pixdata, |
||||
unsigned i, unsigned j, unsigned char *value, unsigned comps); |
||||
|
||||
void util_format_signed_fetch_texel_rgtc(unsigned srcRowStride, const signed char *pixdata, |
||||
unsigned i, unsigned j, signed char *value, unsigned comps); |
||||
|
||||
void util_format_unsigned_encode_rgtc_ubyte(unsigned char *blkaddr, unsigned char srccolors[4][4], |
||||
int numxpixels, int numypixels); |
||||
|
||||
void util_format_signed_encode_rgtc_ubyte(signed char *blkaddr, signed char srccolors[4][4], |
||||
int numxpixels, int numypixels); |
||||
#endif /* _RGTC_H */ |
@ -1,328 +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. |
||||
*
|
||||
**************************************************************************/ |
||||
|
||||
/**
|
||||
* @file |
||||
* Generic bitmask implementation. |
||||
*
|
||||
* @author Jose Fonseca <jfonseca@vmware.com> |
||||
*/ |
||||
|
||||
|
||||
#include "pipe/p_compiler.h" |
||||
#include "util/u_debug.h" |
||||
|
||||
#include "util/u_memory.h" |
||||
#include "util/u_bitmask.h" |
||||
|
||||
|
||||
typedef uint32_t util_bitmask_word;
|
||||
|
||||
|
||||
#define UTIL_BITMASK_INITIAL_WORDS 16 |
||||
#define UTIL_BITMASK_BITS_PER_BYTE 8 |
||||
#define UTIL_BITMASK_BITS_PER_WORD (sizeof(util_bitmask_word) * UTIL_BITMASK_BITS_PER_BYTE) |
||||
|
||||
|
||||
struct util_bitmask |
||||
{ |
||||
util_bitmask_word *words; |
||||
|
||||
/** Number of bits we can currently hold */ |
||||
unsigned size; |
||||
|
||||
/** Number of consecutive bits set at the start of the bitmask */ |
||||
unsigned filled; |
||||
}; |
||||
|
||||
|
||||
struct util_bitmask * |
||||
util_bitmask_create(void) |
||||
{ |
||||
struct util_bitmask *bm; |
||||
|
||||
bm = MALLOC_STRUCT(util_bitmask); |
||||
if(!bm) |
||||
return NULL; |
||||
|
||||
bm->words = (util_bitmask_word *)CALLOC(UTIL_BITMASK_INITIAL_WORDS, sizeof(util_bitmask_word)); |
||||
if(!bm->words) { |
||||
FREE(bm); |
||||
return NULL; |
||||
} |
||||
|
||||
bm->size = UTIL_BITMASK_INITIAL_WORDS * UTIL_BITMASK_BITS_PER_WORD; |
||||
bm->filled = 0; |
||||
|
||||
return bm; |
||||
} |
||||
|
||||
|
||||
/**
|
||||
* Resize the bitmask if necessary
|
||||
*/ |
||||
static inline boolean |
||||
util_bitmask_resize(struct util_bitmask *bm, |
||||
unsigned minimum_index) |
||||
{ |
||||
unsigned minimum_size = minimum_index + 1; |
||||
unsigned new_size; |
||||
util_bitmask_word *new_words; |
||||
|
||||
/* Check integer overflow */ |
||||
if(!minimum_size) |
||||
return FALSE; |
||||
|
||||
if(bm->size >= minimum_size) |
||||
return TRUE; |
||||
|
||||
assert(bm->size % UTIL_BITMASK_BITS_PER_WORD == 0); |
||||
new_size = bm->size; |
||||
while(new_size < minimum_size) { |
||||
new_size *= 2; |
||||
/* Check integer overflow */ |
||||
if(new_size < bm->size) |
||||
return FALSE; |
||||
} |
||||
assert(new_size); |
||||
assert(new_size % UTIL_BITMASK_BITS_PER_WORD == 0); |
||||
|
||||
new_words = (util_bitmask_word *)REALLOC((void *)bm->words, |
||||
bm->size / UTIL_BITMASK_BITS_PER_BYTE, |
||||
new_size / UTIL_BITMASK_BITS_PER_BYTE); |
||||
if(!new_words) |
||||
return FALSE; |
||||
|
||||
memset(new_words + bm->size/UTIL_BITMASK_BITS_PER_WORD,
|
||||
0,
|
||||
(new_size - bm->size)/UTIL_BITMASK_BITS_PER_BYTE); |
||||
|
||||
bm->size = new_size; |
||||
bm->words = new_words; |
||||
|
||||
return TRUE; |
||||
} |
||||
|
||||
|
||||
/**
|
||||
* Lazily update the filled. |
||||
*/ |
||||
static inline void |
||||
util_bitmask_filled_set(struct util_bitmask *bm, |
||||
unsigned index) |
||||
{ |
||||
assert(bm->filled <= bm->size); |
||||
assert(index < bm->size); |
||||
|
||||
if(index == bm->filled) { |
||||
++bm->filled; |
||||
assert(bm->filled <= bm->size); |
||||
} |
||||
} |
||||
|
||||
static inline void |
||||
util_bitmask_filled_unset(struct util_bitmask *bm, |
||||
unsigned index) |
||||
{ |
||||
assert(bm->filled <= bm->size); |
||||
assert(index < bm->size); |
||||
|
||||
if(index < bm->filled) |
||||
bm->filled = index; |
||||
} |
||||
|
||||
|
||||
unsigned |
||||
util_bitmask_add(struct util_bitmask *bm) |
||||
{ |
||||
unsigned word; |
||||
unsigned bit; |
||||
util_bitmask_word mask; |
||||
|
||||
assert(bm); |
||||
|
||||
/* linear search for an empty index */ |
||||
word = bm->filled / UTIL_BITMASK_BITS_PER_WORD; |
||||
bit = bm->filled % UTIL_BITMASK_BITS_PER_WORD; |
||||
mask = 1 << bit; |
||||
while(word < bm->size / UTIL_BITMASK_BITS_PER_WORD) { |
||||
while(bit < UTIL_BITMASK_BITS_PER_WORD) { |
||||
if(!(bm->words[word] & mask)) |
||||
goto found; |
||||
++bm->filled; |
||||
++bit; |
||||
mask <<= 1; |
||||
} |
||||
++word; |
||||
bit = 0; |
||||
mask = 1; |
||||
} |
||||
found: |
||||
|
||||
/* grow the bitmask if necessary */ |
||||
if(!util_bitmask_resize(bm, bm->filled)) |
||||
return UTIL_BITMASK_INVALID_INDEX; |
||||
|
||||
assert(!(bm->words[word] & mask)); |
||||
bm->words[word] |= mask; |
||||
|
||||
return bm->filled++; |
||||
} |
||||
|
||||
|
||||
unsigned |
||||
util_bitmask_set(struct util_bitmask *bm,
|
||||
unsigned index) |
||||
{ |
||||
unsigned word; |
||||
unsigned bit; |
||||
util_bitmask_word mask; |
||||
|
||||
assert(bm); |
||||
|
||||
/* grow the bitmask if necessary */ |
||||
if(!util_bitmask_resize(bm, index)) |
||||
return UTIL_BITMASK_INVALID_INDEX; |
||||
|
||||
word = index / UTIL_BITMASK_BITS_PER_WORD; |
||||
bit = index % UTIL_BITMASK_BITS_PER_WORD; |
||||
mask = 1 << bit; |
||||
|
||||
bm->words[word] |= mask; |
||||
|
||||
util_bitmask_filled_set(bm, index); |
||||
|
||||
return index; |
||||
} |
||||
|
||||
|
||||
void |
||||
util_bitmask_clear(struct util_bitmask *bm,
|
||||
unsigned index) |
||||
{ |
||||
unsigned word; |
||||
unsigned bit; |
||||
util_bitmask_word mask; |
||||
|
||||
assert(bm); |
||||
|
||||
if(index >= bm->size) |
||||
return; |
||||
|
||||
word = index / UTIL_BITMASK_BITS_PER_WORD; |
||||
bit = index % UTIL_BITMASK_BITS_PER_WORD; |
||||
mask = 1 << bit; |
||||
|
||||
bm->words[word] &= ~mask; |
||||
|
||||
util_bitmask_filled_unset(bm, index); |
||||
} |
||||
|
||||
|
||||
boolean |
||||
util_bitmask_get(struct util_bitmask *bm,
|
||||
unsigned index) |
||||
{ |
||||
unsigned word = index / UTIL_BITMASK_BITS_PER_WORD; |
||||
unsigned bit = index % UTIL_BITMASK_BITS_PER_WORD; |
||||
util_bitmask_word mask = 1 << bit; |
||||
|
||||
assert(bm); |
||||
|
||||
if(index < bm->filled) { |
||||
assert(bm->words[word] & mask); |
||||
return TRUE; |
||||
} |
||||
|
||||
if(index >= bm->size) |
||||
return FALSE; |
||||
|
||||
if(bm->words[word] & mask) { |
||||
util_bitmask_filled_set(bm, index); |
||||
return TRUE; |
||||
} |
||||
else |
||||
return FALSE; |
||||
} |
||||
|
||||
|
||||
unsigned |
||||
util_bitmask_get_next_index(struct util_bitmask *bm,
|
||||
unsigned index) |
||||
{ |
||||
unsigned word = index / UTIL_BITMASK_BITS_PER_WORD; |
||||
unsigned bit = index % UTIL_BITMASK_BITS_PER_WORD; |
||||
util_bitmask_word mask = 1 << bit; |
||||
|
||||
if(index < bm->filled) { |
||||
assert(bm->words[word] & mask); |
||||
return index; |
||||
} |
||||
|
||||
if(index >= bm->size) { |
||||
return UTIL_BITMASK_INVALID_INDEX; |
||||
} |
||||
|
||||
/* Do a linear search */ |
||||
while(word < bm->size / UTIL_BITMASK_BITS_PER_WORD) { |
||||
while(bit < UTIL_BITMASK_BITS_PER_WORD) { |
||||
if(bm->words[word] & mask) { |
||||
if(index == bm->filled) { |
||||
++bm->filled; |
||||
assert(bm->filled <= bm->size); |
||||
} |
||||
return index; |
||||
} |
||||
++index; |
||||
++bit; |
||||
mask <<= 1; |
||||
} |
||||
++word; |
||||
bit = 0; |
||||
mask = 1; |
||||
} |
||||
|
||||
return UTIL_BITMASK_INVALID_INDEX; |
||||
} |
||||
|
||||
|
||||
unsigned |
||||
util_bitmask_get_first_index(struct util_bitmask *bm) |
||||
{ |
||||
return util_bitmask_get_next_index(bm, 0); |
||||
} |
||||
|
||||
|
||||
void |
||||
util_bitmask_destroy(struct util_bitmask *bm) |
||||
{ |
||||
assert(bm); |
||||
|
||||
FREE(bm->words); |
||||
FREE(bm); |
||||
} |
||||
|
@ -1,117 +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. |
||||
*
|
||||
**************************************************************************/ |
||||
|
||||
/**
|
||||
* @file |
||||
* Generic bitmask. |
||||
*
|
||||
* @author Jose Fonseca <jfonseca@vmware.com> |
||||
*/ |
||||
|
||||
#ifndef U_HANDLE_BITMASK_H_ |
||||
#define U_HANDLE_BITMASK_H_ |
||||
|
||||
|
||||
#include "pipe/p_compiler.h" |
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
#define UTIL_BITMASK_INVALID_INDEX (~0U) |
||||
|
||||
|
||||
/**
|
||||
* Abstract data type to represent arbitrary set of bits. |
||||
*/ |
||||
struct util_bitmask; |
||||
|
||||
|
||||
struct util_bitmask * |
||||
util_bitmask_create(void); |
||||
|
||||
|
||||
/**
|
||||
* Search a cleared bit and set it. |
||||
*
|
||||
* It searches for the first cleared bit. |
||||
*
|
||||
* Returns the bit index on success, or UTIL_BITMASK_INVALID_INDEX on out of
|
||||
* memory growing the bitmask. |
||||
*/ |
||||
unsigned |
||||
util_bitmask_add(struct util_bitmask *bm); |
||||
|
||||
/**
|
||||
* Set a bit. |
||||
*
|
||||
* Returns the input index on success, or UTIL_BITMASK_INVALID_INDEX on out of
|
||||
* memory growing the bitmask. |
||||
*/ |
||||
unsigned |
||||
util_bitmask_set(struct util_bitmask *bm,
|
||||
unsigned index); |
||||
|
||||
void |
||||
util_bitmask_clear(struct util_bitmask *bm,
|
||||
unsigned index); |
||||
|
||||
boolean |
||||
util_bitmask_get(struct util_bitmask *bm,
|
||||
unsigned index); |
||||
|
||||
|
||||
void |
||||
util_bitmask_destroy(struct util_bitmask *bm); |
||||
|
||||
|
||||
/**
|
||||
* Search for the first set bit. |
||||
*
|
||||
* Returns UTIL_BITMASK_INVALID_INDEX if a set bit cannot be found.
|
||||
*/ |
||||
unsigned |
||||
util_bitmask_get_first_index(struct util_bitmask *bm); |
||||
|
||||
|
||||
/**
|
||||
* Search for the first set bit, starting from the giving index. |
||||
*
|
||||
* Returns UTIL_BITMASK_INVALID_INDEX if a set bit cannot be found.
|
||||
*/ |
||||
unsigned |
||||
util_bitmask_get_next_index(struct util_bitmask *bm, |
||||
unsigned index); |
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} |
||||
#endif |
||||
|
||||
#endif /* U_HANDLE_BITMASK_H_ */ |
Loading…
Reference in new issue