Exemplo n.º 1
0
	void D3DUnitMap::set_sampler(D3DGraphicContextProvider *gc, int index, const Texture &texture)
	{
		if (sampler_units.size() < index + 1)
			sampler_units.resize(index + 1);
		sampler_units[index].object = texture;
		bind_sampler(gc, index);
	}
void GLAPIENTRY
_mesa_BindSampler(GLuint unit, GLuint sampler)
{
   GET_CURRENT_CONTEXT(ctx);

   if (unit >= ctx->Const.MaxCombinedTextureImageUnits) {
      _mesa_error(ctx, GL_INVALID_VALUE, "glBindSampler(unit %u)", unit);
      return;
   }

   bind_sampler(ctx, unit, sampler, false);
}
Exemplo n.º 3
0
	void D3DUnitMap::bind_program(D3DGraphicContextProvider *gc, D3DProgramObjectProvider *program)
	{
		for (size_t i = 0; i < program->uniforms.size(); i++)
		{
			switch (program->uniforms[i].type)
			{
			case D3DUniform::type_sampler:
				if (sampler_units.size() < program->uniforms[i].value + 1)
					sampler_units.resize(program->uniforms[i].value + 1);
				for (int j = 0; j < shadertype_num_types; j++)
					sampler_units[program->uniforms[i].value].shader_index[j] = program->uniforms[i].shader_index[j];
				bind_sampler(gc, program->uniforms[i].value);
				break;
			case D3DUniform::type_texture:
				if (texture_units.size() < program->uniforms[i].value + 1)
					texture_units.resize(program->uniforms[i].value + 1);
				for (int j = 0; j < shadertype_num_types; j++)
					texture_units[program->uniforms[i].value].shader_index[j] = program->uniforms[i].shader_index[j];
				bind_texture(gc, program->uniforms[i].value);
				break;
			case D3DUniform::type_image:
				if (image_units.size() < program->uniforms[i].value + 1)
					image_units.resize(program->uniforms[i].value + 1);
				for (int j = 0; j < shadertype_num_types; j++)
					image_units[program->uniforms[i].value].shader_index[j] = program->uniforms[i].shader_index[j];
				bind_image(gc, program->uniforms[i].value);
				break;
			}
		}

		for (size_t i = 0; i < program->uniform_blocks.size(); i++)
		{
			if (uniform_units.size() < program->uniform_blocks[i].value + 1)
				uniform_units.resize(program->uniform_blocks[i].value + 1);
			for (int j = 0; j < shadertype_num_types; j++)
				uniform_units[program->uniform_blocks[i].value].shader_index[j] = program->uniform_blocks[i].shader_index[j];
			bind_uniform_buffer(gc, program->uniform_blocks[i].value);
		}

		for (size_t i = 0; i < program->storage_blocks.size(); i++)
		{
			if (storage_units.size() < program->storage_blocks[i].value + 1)
				storage_units.resize(program->storage_blocks[i].value + 1);
			for (int j = 0; j < shadertype_num_types; j++)
			{
				storage_units[program->storage_blocks[i].value].shader_srv_index[j] = program->storage_blocks[i].shader_srv_index[j];
				storage_units[program->storage_blocks[i].value].shader_uav_index[j] = program->storage_blocks[i].shader_uav_index[j];
			}
			bind_storage_buffer(gc, program->storage_blocks[i].value);
		}
	}
void GLAPIENTRY
_mesa_BindSampler_no_error(GLuint unit, GLuint sampler)
{
   GET_CURRENT_CONTEXT(ctx);
   bind_sampler(ctx, unit, sampler, true);
}
Exemplo n.º 5
0
	static
	auto bind(texture_unit unit, sampler_name sam)
	noexcept
	{
		return bind_sampler(unit, sam);
	}