diff options
author | Tim Rowley <[email protected]> | 2016-04-26 11:22:24 -0500 |
---|---|---|
committer | Tim Rowley <[email protected]> | 2016-04-26 16:45:26 -0500 |
commit | 18d1658633d5ca5147e0b1a2cd22ea7ffa1b5093 (patch) | |
tree | 692bf56e9e34f074693f5dc71f28b53ad370851a /src | |
parent | 12cf08fcc3e3229ce8b4f8f9b3230388b16a7e62 (diff) |
swr: autogenerate swr_context_llvm.h
Reviewed-by: Bruce Cherniak <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/swr/.gitignore | 1 | ||||
-rw-r--r-- | src/gallium/drivers/swr/Makefile.am | 7 | ||||
-rw-r--r-- | src/gallium/drivers/swr/Makefile.sources | 1 | ||||
-rw-r--r-- | src/gallium/drivers/swr/rasterizer/jitter/scripts/gen_llvm_types.py | 3 | ||||
-rw-r--r-- | src/gallium/drivers/swr/swr_context.h | 8 | ||||
-rw-r--r-- | src/gallium/drivers/swr/swr_context_llvm.h | 124 |
6 files changed, 16 insertions, 128 deletions
diff --git a/src/gallium/drivers/swr/.gitignore b/src/gallium/drivers/swr/.gitignore index c5b6416ee30..6b4de9e2e31 100644 --- a/src/gallium/drivers/swr/.gitignore +++ b/src/gallium/drivers/swr/.gitignore @@ -1,3 +1,4 @@ +swr_context_llvm.h rasterizer/jitter/builder_gen.cpp rasterizer/jitter/builder_gen.h rasterizer/jitter/builder_x86.cpp diff --git a/src/gallium/drivers/swr/Makefile.am b/src/gallium/drivers/swr/Makefile.am index b1ff4233b56..6915aae356c 100644 --- a/src/gallium/drivers/swr/Makefile.am +++ b/src/gallium/drivers/swr/Makefile.am @@ -47,6 +47,7 @@ COMMON_SOURCES = \ $(BUILT_SOURCES) BUILT_SOURCES = \ + swr_context_llvm.h \ rasterizer/scripts/gen_knobs.cpp \ rasterizer/scripts/gen_knobs.h \ rasterizer/jitter/state_llvm.h \ @@ -55,6 +56,12 @@ BUILT_SOURCES = \ rasterizer/jitter/builder_x86.h \ rasterizer/jitter/builder_x86.cpp +swr_context_llvm.h: rasterizer/jitter/scripts/gen_llvm_types.py swr_context.h + $(PYTHON2) $(PYTHON_FLAGS) \ + $(srcdir)/rasterizer/jitter/scripts/gen_llvm_types.py \ + --input $(srcdir)/swr_context.h \ + --output swr_context_llvm.h + rasterizer/scripts/gen_knobs.cpp rasterizer/scripts/gen_knobs.h: rasterizer/scripts/gen_knobs.py rasterizer/scripts/knob_defs.py rasterizer/scripts/templates/knobs.template $(PYTHON2) $(PYTHON_FLAGS) \ $(srcdir)/rasterizer/scripts/gen_knobs.py \ diff --git a/src/gallium/drivers/swr/Makefile.sources b/src/gallium/drivers/swr/Makefile.sources index be3d8f027f8..d8be0f5cca4 100644 --- a/src/gallium/drivers/swr/Makefile.sources +++ b/src/gallium/drivers/swr/Makefile.sources @@ -26,7 +26,6 @@ CXX_SOURCES := \ swr_clear.cpp \ swr_context.cpp \ swr_context.h \ - swr_context_llvm.h \ swr_draw.cpp \ swr_public.h \ swr_resource.h \ diff --git a/src/gallium/drivers/swr/rasterizer/jitter/scripts/gen_llvm_types.py b/src/gallium/drivers/swr/rasterizer/jitter/scripts/gen_llvm_types.py index 0b53a929e6c..d6babd39b6b 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/scripts/gen_llvm_types.py +++ b/src/gallium/drivers/swr/rasterizer/jitter/scripts/gen_llvm_types.py @@ -135,6 +135,9 @@ def gen_llvm_types(input_file, output_file): for idx in range(len(lines)): line = lines[idx].rstrip() + if "gen_llvm_types FINI" in line: + break + match = re.match(r"(\s*)struct(\s*)(\w+)", line) if match: llvm_args = [] diff --git a/src/gallium/drivers/swr/swr_context.h b/src/gallium/drivers/swr/swr_context.h index 73a8e8ddda1..a7383bbad28 100644 --- a/src/gallium/drivers/swr/swr_context.h +++ b/src/gallium/drivers/swr/swr_context.h @@ -65,7 +65,7 @@ struct swr_jit_texture { uint32_t depth; // doubles as array size uint32_t first_level; uint32_t last_level; - const void *base_ptr; + const uint8_t *base_ptr; uint32_t row_stride[PIPE_MAX_TEXTURE_LEVELS]; uint32_t img_stride[PIPE_MAX_TEXTURE_LEVELS]; uint32_t mip_offsets[PIPE_MAX_TEXTURE_LEVELS]; @@ -80,9 +80,9 @@ struct swr_jit_sampler { struct swr_draw_context { const float *constantVS[PIPE_MAX_CONSTANT_BUFFERS]; - unsigned num_constantsVS[PIPE_MAX_CONSTANT_BUFFERS]; + uint32_t num_constantsVS[PIPE_MAX_CONSTANT_BUFFERS]; const float *constantFS[PIPE_MAX_CONSTANT_BUFFERS]; - unsigned num_constantsFS[PIPE_MAX_CONSTANT_BUFFERS]; + uint32_t num_constantsFS[PIPE_MAX_CONSTANT_BUFFERS]; swr_jit_texture texturesVS[PIPE_MAX_SHADER_SAMPLER_VIEWS]; swr_jit_sampler samplersVS[PIPE_MAX_SAMPLERS]; @@ -92,6 +92,8 @@ struct swr_draw_context { SWR_SURFACE_STATE renderTargets[SWR_NUM_ATTACHMENTS]; }; +/* gen_llvm_types FINI */ + struct swr_context { struct pipe_context pipe; /**< base class */ diff --git a/src/gallium/drivers/swr/swr_context_llvm.h b/src/gallium/drivers/swr/swr_context_llvm.h deleted file mode 100644 index 58da813123f..00000000000 --- a/src/gallium/drivers/swr/swr_context_llvm.h +++ /dev/null @@ -1,124 +0,0 @@ -/**************************************************************************** - * Copyright (C) 2015 Intel Corporation. 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. - ***************************************************************************/ - -#pragma once - -////////////////////////////////////////////////////////////////////////// -/// Generate LLVM type information for swr_jit_texture -INLINE static StructType * -Gen_swr_jit_texture(JitManager *pShG) -{ - LLVMContext &ctx = pShG->mContext; - std::vector<Type *> members; - - members.push_back(Type::getInt32Ty(ctx)); // width - members.push_back(Type::getInt32Ty(ctx)); // height - members.push_back(Type::getInt32Ty(ctx)); // depth - members.push_back(Type::getInt32Ty(ctx)); // first_level - members.push_back(Type::getInt32Ty(ctx)); // last_level - members.push_back(PointerType::get(Type::getInt8Ty(ctx), 0)); // base_ptr - members.push_back(ArrayType::get(Type::getInt32Ty(ctx), - PIPE_MAX_TEXTURE_LEVELS)); // row_stride - members.push_back(ArrayType::get(Type::getInt32Ty(ctx), - PIPE_MAX_TEXTURE_LEVELS)); // img_stride - members.push_back(ArrayType::get(Type::getInt32Ty(ctx), - PIPE_MAX_TEXTURE_LEVELS)); // mip_offsets - - return StructType::get(ctx, members, false); -} - -static const UINT swr_jit_texture_width = 0; -static const UINT swr_jit_texture_height = 1; -static const UINT swr_jit_texture_depth = 2; -static const UINT swr_jit_texture_first_level = 3; -static const UINT swr_jit_texture_last_level = 4; -static const UINT swr_jit_texture_base_ptr = 5; -static const UINT swr_jit_texture_row_stride = 6; -static const UINT swr_jit_texture_img_stride = 7; -static const UINT swr_jit_texture_mip_offsets = 8; - -////////////////////////////////////////////////////////////////////////// -/// Generate LLVM type information for swr_jit_sampler -INLINE static StructType * -Gen_swr_jit_sampler(JitManager *pShG) -{ - LLVMContext &ctx = pShG->mContext; - std::vector<Type *> members; - - members.push_back(Type::getFloatTy(ctx)); // min_lod - members.push_back(Type::getFloatTy(ctx)); // max_lod - members.push_back(Type::getFloatTy(ctx)); // lod_bias - members.push_back( - ArrayType::get(Type::getFloatTy(ctx), 4)); // border_color - - return StructType::get(ctx, members, false); -} - -static const UINT swr_jit_sampler_min_lod = 0; -static const UINT swr_jit_sampler_max_lod = 1; -static const UINT swr_jit_sampler_lod_bias = 2; -static const UINT swr_jit_sampler_border_color = 3; - -////////////////////////////////////////////////////////////////////////// -/// Generate LLVM type information for swr_draw_context -INLINE static StructType * -Gen_swr_draw_context(JitManager *pShG) -{ - LLVMContext &ctx = pShG->mContext; - std::vector<Type *> members; - - members.push_back( - ArrayType::get(PointerType::get(Type::getFloatTy(ctx), 0), - PIPE_MAX_CONSTANT_BUFFERS)); // constantVS - members.push_back(ArrayType::get( - Type::getInt32Ty(ctx), PIPE_MAX_CONSTANT_BUFFERS)); // num_constantsVS - members.push_back( - ArrayType::get(PointerType::get(Type::getFloatTy(ctx), 0), - PIPE_MAX_CONSTANT_BUFFERS)); // constantFS - members.push_back(ArrayType::get( - Type::getInt32Ty(ctx), PIPE_MAX_CONSTANT_BUFFERS)); // num_constantsFS - members.push_back( - ArrayType::get(Gen_swr_jit_texture(pShG), - PIPE_MAX_SHADER_SAMPLER_VIEWS)); // texturesVS - members.push_back(ArrayType::get(Gen_swr_jit_sampler(pShG), - PIPE_MAX_SAMPLERS)); // samplersVS - members.push_back( - ArrayType::get(Gen_swr_jit_texture(pShG), - PIPE_MAX_SHADER_SAMPLER_VIEWS)); // texturesFS - members.push_back(ArrayType::get(Gen_swr_jit_sampler(pShG), - PIPE_MAX_SAMPLERS)); // samplersFS - members.push_back(ArrayType::get(Gen_SWR_SURFACE_STATE(pShG), - SWR_NUM_ATTACHMENTS)); // renderTargets - - return StructType::get(ctx, members, false); -} - -static const UINT swr_draw_context_constantVS = 0; -static const UINT swr_draw_context_num_constantsVS = 1; -static const UINT swr_draw_context_constantFS = 2; -static const UINT swr_draw_context_num_constantsFS = 3; -static const UINT swr_draw_context_texturesVS = 4; -static const UINT swr_draw_context_samplersVS = 5; -static const UINT swr_draw_context_texturesFS = 6; -static const UINT swr_draw_context_samplersFS = 7; -static const UINT swr_draw_context_renderTargets = 8; |