~mmach/netext73/mesa-ryzen

« back to all changes in this revision

Viewing changes to src/gallium/drivers/llvmpipe/lp_state_fs_linear_llvm.c

  • Committer: mmach
  • Date: 2023-11-02 21:31:35 UTC
  • Revision ID: netbit73@gmail.com-20231102213135-18d4tzh7tj0uz752
2023-11-02 22:11:57

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
#include "pipe/p_shader_tokens.h"
39
39
#include "draw/draw_context.h"
40
40
#include "tgsi/tgsi_dump.h"
41
 
#include "tgsi/tgsi_scan.h"
42
 
#include "tgsi/tgsi_parse.h"
43
41
#include "gallivm/lp_bld_type.h"
44
42
#include "gallivm/lp_bld_const.h"
45
43
#include "gallivm/lp_bld_conv.h"
98
96
   struct linear_sampler *sampler = (struct linear_sampler *)base;
99
97
 
100
98
   if (sampler->instance >= LP_MAX_LINEAR_TEXTURES) {
101
 
      assert(FALSE);
 
99
      assert(false);
102
100
      return bld->undef;
103
101
   }
104
102
 
139
137
                   LLVMValueRef dst)
140
138
{
141
139
   static const unsigned char bgra_swizzles[4] = {2, 1, 0, 3};
 
140
   static const unsigned char rgba_swizzles[4] = {0, 1, 2, 3};
142
141
   LLVMValueRef inputs[PIPE_MAX_SHADER_INPUTS];
143
142
   LLVMValueRef outputs[PIPE_MAX_SHADER_OUTPUTS];
144
143
   LLVMBuilderRef builder = bld->gallivm->builder;
145
144
   struct gallivm_state *gallivm = bld->gallivm;
146
145
   LLVMValueRef result = NULL;
 
146
   bool rgba_order = (variant->key.cbuf_format[0] == PIPE_FORMAT_R8G8B8A8_UNORM ||
 
147
                      variant->key.cbuf_format[0] == PIPE_FORMAT_R8G8B8X8_UNORM);
147
148
 
148
149
   sampler->instance = 0;
149
150
 
166
167
 
167
168
   if (shader->base.type == PIPE_SHADER_IR_TGSI) {
168
169
      lp_build_tgsi_aos(gallivm, shader->base.tokens, fs_type,
169
 
                        bgra_swizzles,
 
170
                        rgba_order ? rgba_swizzles : bgra_swizzles,
170
171
                        consts_ptr, inputs, outputs,
171
172
                        &sampler->base,
172
173
                        &shader->info.base);
173
174
   } else {
174
175
      nir_shader *clone = nir_shader_clone(NULL, shader->base.ir.nir);
175
176
      lp_build_nir_aos(gallivm, clone, fs_type,
176
 
                       bgra_swizzles,
 
177
                       rgba_order ? rgba_swizzles : bgra_swizzles,
177
178
                       consts_ptr, inputs, outputs,
178
179
                       &sampler->base,
179
180
                       &shader->info.base);
228
229
                                  mask,
229
230
                                  blend_color,  /* const_ */
230
231
                                  NULL,         /* const_alpha */
231
 
                                  bgra_swizzles,
 
232
                                  rgba_order ? rgba_swizzles : bgra_swizzles,
232
233
                                  4);
233
234
   }
234
235
 
259
260
   // unorm8[16] vector type
260
261
   struct lp_type fs_type;
261
262
   memset(&fs_type, 0, sizeof fs_type);
262
 
   fs_type.floating = FALSE;
263
 
   fs_type.sign = FALSE;
264
 
   fs_type.norm = TRUE;
 
263
   fs_type.floating = false;
 
264
   fs_type.sign = false;
 
265
   fs_type.norm = true;
265
266
   fs_type.width = 8;
266
267
   fs_type.length = 16;
267
268