diff options
Diffstat (limited to 'src/mesa/shader/slang/slang_ir.c')
-rw-r--r-- | src/mesa/shader/slang/slang_ir.c | 72 |
1 files changed, 71 insertions, 1 deletions
diff --git a/src/mesa/shader/slang/slang_ir.c b/src/mesa/shader/slang/slang_ir.c index 4fe3a2b85d..e4c6e0ea51 100644 --- a/src/mesa/shader/slang/slang_ir.c +++ b/src/mesa/shader/slang/slang_ir.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 7.1 * * Copyright (C) 2005-2008 Brian Paul All Rights Reserved. + * Copyright (C) 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"), @@ -116,6 +116,20 @@ _slang_ir_info(slang_ir_opcode opcode) } +void +_slang_init_ir_storage(slang_ir_storage *st, + enum register_file file, GLint index, GLint size, + GLuint swizzle) +{ + st->File = file; + st->Index = index; + st->Size = size; + st->Swizzle = swizzle; + st->Parent = NULL; + st->IsIndirect = GL_FALSE; +} + + /** * Return a new slang_ir_storage object. */ @@ -130,6 +144,7 @@ _slang_new_ir_storage(enum register_file file, GLint index, GLint size) st->Size = size; st->Swizzle = SWIZZLE_NOOP; st->Parent = NULL; + st->IsIndirect = GL_FALSE; } return st; } @@ -150,6 +165,7 @@ _slang_new_ir_storage_swz(enum register_file file, GLint index, GLint size, st->Size = size; st->Swizzle = swizzle; st->Parent = NULL; + st->IsIndirect = GL_FALSE; } return st; } @@ -170,12 +186,66 @@ _slang_new_ir_storage_relative(GLint index, GLint size, st->Size = size; st->Swizzle = SWIZZLE_NOOP; st->Parent = parent; + st->IsIndirect = GL_FALSE; + } + return st; +} + + +slang_ir_storage * +_slang_new_ir_storage_indirect(enum register_file file, + GLint index, + GLint size, + enum register_file indirectFile, + GLint indirectIndex, + GLuint indirectSwizzle) +{ + slang_ir_storage *st; + st = (slang_ir_storage *) _slang_alloc(sizeof(slang_ir_storage)); + if (st) { + st->File = file; + st->Index = index; + st->Size = size; + st->Swizzle = SWIZZLE_NOOP; + st->IsIndirect = GL_TRUE; + st->IndirectFile = indirectFile; + st->IndirectIndex = indirectIndex; + st->IndirectSwizzle = indirectSwizzle; + } + return st; +} + + +/** + * Allocate IR storage for a texture sampler. + * \param sampNum the sampler number/index + * \param texTarget one of TEXTURE_x_INDEX values + * \param size number of samplers (in case of sampler array) + */ +slang_ir_storage * +_slang_new_ir_storage_sampler(GLint sampNum, GLuint texTarget, GLint size) +{ + slang_ir_storage *st; + assert(texTarget < NUM_TEXTURE_TARGETS); + st = _slang_new_ir_storage(PROGRAM_SAMPLER, sampNum, size); + if (st) { + st->TexTarget = texTarget; } return st; } +/* XXX temporary function */ +void +_slang_copy_ir_storage(slang_ir_storage *dst, const slang_ir_storage *src) +{ + *dst = *src; + dst->Parent = NULL; +} + + + static const char * _slang_ir_name(slang_ir_opcode opcode) { |