static void i915_bind_vertex_sampler_states(struct pipe_context *pipe, unsigned num_samplers, void **samplers) { struct i915_context *i915 = i915_context(pipe); unsigned i; assert(num_samplers <= Elements(i915->vertex_samplers)); /* Check for no-op */ if (num_samplers == i915->num_vertex_samplers && !memcmp(i915->vertex_samplers, samplers, num_samplers * sizeof(void *))) return; for (i = 0; i < num_samplers; ++i) i915->vertex_samplers[i] = samplers[i]; for (i = num_samplers; i < Elements(i915->vertex_samplers); ++i) i915->vertex_samplers[i] = NULL; i915->num_vertex_samplers = num_samplers; draw_set_samplers(i915->draw, PIPE_SHADER_VERTEX, i915->vertex_samplers, i915->num_vertex_samplers); }
static void i915_bind_vertex_sampler_states(struct pipe_context *pipe, unsigned start, unsigned num, void **samplers) { struct i915_context *i915 = i915_context(pipe); unsigned i; assert(start + num <= ARRAY_SIZE(i915->vertex_samplers)); /* Check for no-op */ if (num == i915->num_vertex_samplers && !memcmp(i915->vertex_samplers + start, samplers, num * sizeof(void *))) return; for (i = 0; i < num; ++i) i915->vertex_samplers[i + start] = samplers[i]; /* find highest non-null samplers[] entry */ { unsigned j = MAX2(i915->num_vertex_samplers, start + num); while (j > 0 && i915->vertex_samplers[j - 1] == NULL) j--; i915->num_vertex_samplers = j; } draw_set_samplers(i915->draw, PIPE_SHADER_VERTEX, i915->vertex_samplers, i915->num_vertex_samplers); }
static void llvmpipe_bind_vertex_sampler_states(struct pipe_context *pipe, unsigned num_samplers, void **samplers) { struct llvmpipe_context *llvmpipe = llvmpipe_context(pipe); unsigned i; assert(num_samplers <= PIPE_MAX_VERTEX_SAMPLERS); /* Check for no-op */ if (num_samplers == llvmpipe->num_vertex_samplers && !memcmp(llvmpipe->vertex_samplers, samplers, num_samplers * sizeof(void *))) return; draw_flush(llvmpipe->draw); for (i = 0; i < num_samplers; ++i) llvmpipe->vertex_samplers[i] = samplers[i]; for (i = num_samplers; i < PIPE_MAX_VERTEX_SAMPLERS; ++i) llvmpipe->vertex_samplers[i] = NULL; llvmpipe->num_vertex_samplers = num_samplers; draw_set_samplers(llvmpipe->draw, llvmpipe->vertex_samplers, llvmpipe->num_vertex_samplers); llvmpipe->dirty |= LP_NEW_SAMPLER; }
/** * Bind a range [start, start+num-1] of samplers for a shader stage. */ static void softpipe_bind_sampler_states(struct pipe_context *pipe, unsigned shader, unsigned start, unsigned num, void **samplers) { struct softpipe_context *softpipe = softpipe_context(pipe); unsigned i; assert(shader < PIPE_SHADER_TYPES); assert(start + num <= Elements(softpipe->samplers[shader])); /* Check for no-op */ if (start + num <= softpipe->num_samplers[shader] && !memcmp(softpipe->samplers[shader] + start, samplers, num * sizeof(void *))) { return; } draw_flush(softpipe->draw); /* set the new samplers */ for (i = 0; i < num; i++) { softpipe->samplers[shader][start + i] = samplers[i]; } /* find highest non-null samplers[] entry */ { unsigned j = MAX2(softpipe->num_samplers[shader], start + num); while (j > 0 && softpipe->samplers[shader][j - 1] == NULL) j--; softpipe->num_samplers[shader] = j; } if (shader == PIPE_SHADER_VERTEX || shader == PIPE_SHADER_GEOMETRY) { draw_set_samplers(softpipe->draw, shader, softpipe->samplers[shader], softpipe->num_samplers[shader]); } softpipe->dirty |= SP_NEW_SAMPLER; }
static void llvmpipe_bind_sampler_states(struct pipe_context *pipe, unsigned shader, unsigned start, unsigned num, void **samplers) { struct llvmpipe_context *llvmpipe = llvmpipe_context(pipe); unsigned i; assert(shader < PIPE_SHADER_TYPES); assert(start + num <= Elements(llvmpipe->samplers[shader])); draw_flush(llvmpipe->draw); /* set the new samplers */ for (i = 0; i < num; i++) { llvmpipe->samplers[shader][start + i] = samplers[i]; } /* find highest non-null samplers[] entry */ { unsigned j = MAX2(llvmpipe->num_samplers[shader], start + num); while (j > 0 && llvmpipe->samplers[shader][j - 1] == NULL) j--; llvmpipe->num_samplers[shader] = j; } if (shader == PIPE_SHADER_VERTEX || shader == PIPE_SHADER_GEOMETRY) { draw_set_samplers(llvmpipe->draw, shader, llvmpipe->samplers[shader], llvmpipe->num_samplers[shader]); } else { llvmpipe->dirty |= LP_NEW_SAMPLER; } }
/** * Bind a range [start, start+num-1] of samplers for a shader stage. */ static void softpipe_bind_sampler_states(struct pipe_context *pipe, enum pipe_shader_type shader, unsigned start, unsigned num, void **samplers) { struct softpipe_context *softpipe = softpipe_context(pipe); unsigned i; assert(shader < PIPE_SHADER_TYPES); assert(start + num <= ARRAY_SIZE(softpipe->samplers[shader])); draw_flush(softpipe->draw); /* set the new samplers */ for (i = 0; i < num; i++) { softpipe->samplers[shader][start + i] = samplers[i]; } /* find highest non-null samplers[] entry */ { unsigned j = MAX2(softpipe->num_samplers[shader], start + num); while (j > 0 && softpipe->samplers[shader][j - 1] == NULL) j--; softpipe->num_samplers[shader] = j; } if (shader == PIPE_SHADER_VERTEX || shader == PIPE_SHADER_GEOMETRY) { draw_set_samplers(softpipe->draw, shader, softpipe->samplers[shader], softpipe->num_samplers[shader]); } softpipe->dirty |= SP_NEW_SAMPLER; }