diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2015-11-22 02:46:45 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2015-11-22 02:46:45 +0000 |
commit | 3e40341f9dcd7c1bbc9afb8ddb812304820396cf (patch) | |
tree | 274b3f522afe1da16ab2b5347758c908bc23fac4 /lib/mesa/src/gallium/auxiliary/tgsi/tgsi_build.c | |
parent | 7b644ad52b574bec410d557155d666ac17fdf51a (diff) |
import Mesa 11.0.6
Diffstat (limited to 'lib/mesa/src/gallium/auxiliary/tgsi/tgsi_build.c')
-rw-r--r-- | lib/mesa/src/gallium/auxiliary/tgsi/tgsi_build.c | 227 |
1 files changed, 98 insertions, 129 deletions
diff --git a/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_build.c b/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_build.c index 39c20b5e8..fdb7febf7 100644 --- a/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_build.c +++ b/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_build.c @@ -110,8 +110,6 @@ tgsi_default_declaration( void ) declaration.Invariant = 0; declaration.Local = 0; declaration.Array = 0; - declaration.Atomic = 0; - declaration.MemType = TGSI_MEMORY_TYPE_GLOBAL; declaration.Padding = 0; return declaration; @@ -127,8 +125,6 @@ tgsi_build_declaration( unsigned invariant, unsigned local, unsigned array, - unsigned atomic, - unsigned mem_type, struct tgsi_header *header ) { struct tgsi_declaration declaration; @@ -145,8 +141,6 @@ tgsi_build_declaration( declaration.Invariant = invariant; declaration.Local = local; declaration.Array = array; - declaration.Atomic = atomic; - declaration.MemType = mem_type; header_bodysize_grow( header ); return declaration; @@ -239,10 +233,7 @@ tgsi_default_declaration_semantic( void ) ds.Name = TGSI_SEMANTIC_POSITION; ds.Index = 0; - ds.StreamX = 0; - ds.StreamY = 0; - ds.StreamZ = 0; - ds.StreamW = 0; + ds.Padding = 0; return ds; } @@ -251,10 +242,6 @@ static struct tgsi_declaration_semantic tgsi_build_declaration_semantic( unsigned semantic_name, unsigned semantic_index, - unsigned streamx, - unsigned streamy, - unsigned streamz, - unsigned streamw, struct tgsi_declaration *declaration, struct tgsi_header *header ) { @@ -265,49 +252,43 @@ tgsi_build_declaration_semantic( ds.Name = semantic_name; ds.Index = semantic_index; - ds.StreamX = streamx; - ds.StreamY = streamy; - ds.StreamZ = streamz; - ds.StreamW = streamw; + ds.Padding = 0; declaration_grow( declaration, header ); return ds; } -static struct tgsi_declaration_image -tgsi_default_declaration_image(void) +static struct tgsi_declaration_resource +tgsi_default_declaration_resource(void) { - struct tgsi_declaration_image di; + struct tgsi_declaration_resource dr; - di.Resource = TGSI_TEXTURE_BUFFER; - di.Raw = 0; - di.Writable = 0; - di.Format = 0; - di.Padding = 0; + dr.Resource = TGSI_TEXTURE_BUFFER; + dr.Raw = 0; + dr.Writable = 0; + dr.Padding = 0; - return di; + return dr; } -static struct tgsi_declaration_image -tgsi_build_declaration_image(unsigned texture, - unsigned format, - unsigned raw, - unsigned writable, - struct tgsi_declaration *declaration, - struct tgsi_header *header) +static struct tgsi_declaration_resource +tgsi_build_declaration_resource(unsigned texture, + unsigned raw, + unsigned writable, + struct tgsi_declaration *declaration, + struct tgsi_header *header) { - struct tgsi_declaration_image di; + struct tgsi_declaration_resource dr; - di = tgsi_default_declaration_image(); - di.Resource = texture; - di.Format = format; - di.Raw = raw; - di.Writable = writable; + dr = tgsi_default_declaration_resource(); + dr.Resource = texture; + dr.Raw = raw; + dr.Writable = writable; declaration_grow(declaration, header); - return di; + return dr; } static struct tgsi_declaration_sampler_view @@ -383,7 +364,7 @@ tgsi_default_full_declaration( void ) full_declaration.Range = tgsi_default_declaration_range(); full_declaration.Semantic = tgsi_default_declaration_semantic(); full_declaration.Interp = tgsi_default_declaration_interp(); - full_declaration.Image = tgsi_default_declaration_image(); + full_declaration.Resource = tgsi_default_declaration_resource(); full_declaration.SamplerView = tgsi_default_declaration_sampler_view(); full_declaration.Array = tgsi_default_declaration_array(); @@ -415,8 +396,6 @@ tgsi_build_full_declaration( full_decl->Declaration.Invariant, full_decl->Declaration.Local, full_decl->Declaration.Array, - full_decl->Declaration.Atomic, - full_decl->Declaration.MemType, header ); if (maxsize <= size) @@ -471,29 +450,24 @@ tgsi_build_full_declaration( *ds = tgsi_build_declaration_semantic( full_decl->Semantic.Name, full_decl->Semantic.Index, - full_decl->Semantic.StreamX, - full_decl->Semantic.StreamY, - full_decl->Semantic.StreamZ, - full_decl->Semantic.StreamW, declaration, header ); } - if (full_decl->Declaration.File == TGSI_FILE_IMAGE) { - struct tgsi_declaration_image *di; + if (full_decl->Declaration.File == TGSI_FILE_RESOURCE) { + struct tgsi_declaration_resource *dr; if (maxsize <= size) { return 0; } - di = (struct tgsi_declaration_image *)&tokens[size]; + dr = (struct tgsi_declaration_resource *)&tokens[size]; size++; - *di = tgsi_build_declaration_image(full_decl->Image.Resource, - full_decl->Image.Format, - full_decl->Image.Raw, - full_decl->Image.Writable, - declaration, - header); + *dr = tgsi_build_declaration_resource(full_decl->Resource.Resource, + full_decl->Resource.Raw, + full_decl->Resource.Writable, + declaration, + header); } if (full_decl->Declaration.File == TGSI_FILE_SAMPLER_VIEW) { @@ -637,12 +611,12 @@ tgsi_default_instruction( void ) instruction.NrTokens = 0; instruction.Opcode = TGSI_OPCODE_MOV; instruction.Saturate = 0; + instruction.Predicate = 0; instruction.NumDstRegs = 1; instruction.NumSrcRegs = 1; instruction.Label = 0; instruction.Texture = 0; - instruction.Memory = 0; - instruction.Padding = 0; + instruction.Padding = 0; return instruction; } @@ -650,6 +624,7 @@ tgsi_default_instruction( void ) static struct tgsi_instruction tgsi_build_instruction(unsigned opcode, unsigned saturate, + unsigned predicate, unsigned num_dst_regs, unsigned num_src_regs, struct tgsi_header *header) @@ -664,6 +639,7 @@ tgsi_build_instruction(unsigned opcode, instruction = tgsi_default_instruction(); instruction.Opcode = opcode; instruction.Saturate = saturate; + instruction.Predicate = predicate; instruction.NumDstRegs = num_dst_regs; instruction.NumSrcRegs = num_src_regs; @@ -684,6 +660,47 @@ instruction_grow( header_bodysize_grow( header ); } +struct tgsi_instruction_predicate +tgsi_default_instruction_predicate(void) +{ + struct tgsi_instruction_predicate instruction_predicate; + + instruction_predicate.SwizzleX = TGSI_SWIZZLE_X; + instruction_predicate.SwizzleY = TGSI_SWIZZLE_Y; + instruction_predicate.SwizzleZ = TGSI_SWIZZLE_Z; + instruction_predicate.SwizzleW = TGSI_SWIZZLE_W; + instruction_predicate.Negate = 0; + instruction_predicate.Index = 0; + instruction_predicate.Padding = 0; + + return instruction_predicate; +} + +static struct tgsi_instruction_predicate +tgsi_build_instruction_predicate(int index, + unsigned negate, + unsigned swizzleX, + unsigned swizzleY, + unsigned swizzleZ, + unsigned swizzleW, + struct tgsi_instruction *instruction, + struct tgsi_header *header) +{ + struct tgsi_instruction_predicate instruction_predicate; + + instruction_predicate = tgsi_default_instruction_predicate(); + instruction_predicate.SwizzleX = swizzleX; + instruction_predicate.SwizzleY = swizzleY; + instruction_predicate.SwizzleZ = swizzleZ; + instruction_predicate.SwizzleW = swizzleW; + instruction_predicate.Negate = negate; + instruction_predicate.Index = index; + + instruction_grow(instruction, header); + + return instruction_predicate; +} + static struct tgsi_instruction_label tgsi_default_instruction_label( void ) { @@ -745,40 +762,6 @@ tgsi_build_instruction_texture( return instruction_texture; } -static struct tgsi_instruction_memory -tgsi_default_instruction_memory( void ) -{ - struct tgsi_instruction_memory instruction_memory; - - instruction_memory.Qualifier = 0; - instruction_memory.Texture = 0; - instruction_memory.Format = 0; - instruction_memory.Padding = 0; - - return instruction_memory; -} - -static struct tgsi_instruction_memory -tgsi_build_instruction_memory( - unsigned qualifier, - unsigned texture, - unsigned format, - struct tgsi_token *prev_token, - struct tgsi_instruction *instruction, - struct tgsi_header *header ) -{ - struct tgsi_instruction_memory instruction_memory; - - instruction_memory.Qualifier = qualifier; - instruction_memory.Texture = texture; - instruction_memory.Format = format; - instruction_memory.Padding = 0; - instruction->Memory = 1; - - instruction_grow( instruction, header ); - - return instruction_memory; -} static struct tgsi_texture_offset tgsi_default_texture_offset( void ) @@ -1022,9 +1005,9 @@ tgsi_default_full_instruction( void ) unsigned i; full_instruction.Instruction = tgsi_default_instruction(); + full_instruction.Predicate = tgsi_default_instruction_predicate(); full_instruction.Label = tgsi_default_instruction_label(); full_instruction.Texture = tgsi_default_instruction_texture(); - full_instruction.Memory = tgsi_default_instruction_memory(); for( i = 0; i < TGSI_FULL_MAX_TEX_OFFSETS; i++ ) { full_instruction.TexOffsets[i] = tgsi_default_texture_offset(); } @@ -1057,11 +1040,32 @@ tgsi_build_full_instruction( *instruction = tgsi_build_instruction(full_inst->Instruction.Opcode, full_inst->Instruction.Saturate, + full_inst->Instruction.Predicate, full_inst->Instruction.NumDstRegs, full_inst->Instruction.NumSrcRegs, header); prev_token = (struct tgsi_token *) instruction; + if (full_inst->Instruction.Predicate) { + struct tgsi_instruction_predicate *instruction_predicate; + + if (maxsize <= size) { + return 0; + } + instruction_predicate = (struct tgsi_instruction_predicate *)&tokens[size]; + size++; + + *instruction_predicate = + tgsi_build_instruction_predicate(full_inst->Predicate.Index, + full_inst->Predicate.Negate, + full_inst->Predicate.SwizzleX, + full_inst->Predicate.SwizzleY, + full_inst->Predicate.SwizzleZ, + full_inst->Predicate.SwizzleW, + instruction, + header); + } + if (full_inst->Instruction.Label) { struct tgsi_instruction_label *instruction_label; @@ -1115,26 +1119,6 @@ tgsi_build_full_instruction( prev_token = (struct tgsi_token *) texture_offset; } } - - if (full_inst->Instruction.Memory) { - struct tgsi_instruction_memory *instruction_memory; - - if( maxsize <= size ) - return 0; - instruction_memory = - (struct tgsi_instruction_memory *) &tokens[size]; - size++; - - *instruction_memory = tgsi_build_instruction_memory( - full_inst->Memory.Qualifier, - full_inst->Memory.Texture, - full_inst->Memory.Format, - prev_token, - instruction, - header ); - prev_token = (struct tgsi_token *) instruction_memory; - } - for( i = 0; i < full_inst->Instruction.NumDstRegs; i++ ) { const struct tgsi_full_dst_register *reg = &full_inst->Dst[i]; struct tgsi_dst_register *dst_register; @@ -1387,18 +1371,3 @@ tgsi_build_full_property( return size; } - -struct tgsi_full_src_register -tgsi_full_src_register_from_dst(const struct tgsi_full_dst_register *dst) -{ - struct tgsi_full_src_register src; - src.Register = tgsi_default_src_register(); - src.Register.File = dst->Register.File; - src.Register.Indirect = dst->Register.Indirect; - src.Register.Dimension = dst->Register.Dimension; - src.Register.Index = dst->Register.Index; - src.Indirect = dst->Indirect; - src.Dimension = dst->Dimension; - src.DimIndirect = dst->DimIndirect; - return src; -} |