Beispiel #1
0
GPUTexture *GPU_texture_create_depth(int w, int h, char err_out[256])
{
	GPUTexture *tex = GPU_texture_create_nD(w, h, 2, NULL, 1, err_out);

	if (tex)
		GPU_texture_unbind(tex);
	
	return tex;
}
Beispiel #2
0
GPUTexture *GPU_texture_create_2D(int w, int h, float *fpixels)
{
	GPUTexture *tex = GPU_texture_create_nD(w, h, 2, fpixels, 0);

	if (tex)
		GPU_texture_unbind(tex);
	
	return tex;
}
Beispiel #3
0
GPUTexture *GPU_texture_create_2D(int w, int h, float *fpixels, char err_out[256])
{
	GPUTexture *tex = GPU_texture_create_nD(w, h, 2, fpixels, 0, err_out);

	if (tex)
		GPU_texture_unbind(tex);
	
	return tex;
}
Beispiel #4
0
GPUTexture *GPU_texture_create_depth(int w, int h)
{
	GPUTexture *tex = GPU_texture_create_nD(w, h, 2, NULL, 1);

	if (tex)
		GPU_texture_unbind(tex);
	
	return tex;
}
Beispiel #5
0
GPUTexture *GPU_texture_create_depth_multisample(int w, int h, int samples, char err_out[256])
{
	GPUTexture *tex = GPU_texture_create_nD(w, h, 2, NULL, 1, GPU_HDR_NONE, 1, samples, err_out);

	if (tex)
		GPU_texture_unbind(tex);

	return tex;
}
Beispiel #6
0
GPUTexture *GPU_texture_create_2D(int w, int h, const float *fpixels, GPUHDRType hdr, char err_out[256])
{
	GPUTexture *tex = GPU_texture_create_nD(w, h, 2, fpixels, 0, hdr, 4, 0, err_out);

	if (tex)
		GPU_texture_unbind(tex);
	
	return tex;
}
Beispiel #7
0
GPUTexture *GPU_texture_create_1D(int w, const float *fpixels, char err_out[256])
{
	GPUTexture *tex = GPU_texture_create_nD(w, 1, 1, fpixels, 0, GPU_HDR_NONE, 4, 0, err_out);

	if (tex)
		GPU_texture_unbind(tex);
	
	return tex;
}
Beispiel #8
0
void EEVEE_lightcache_load(LightCache *lcache)
{
  if (lcache->grid_tx.tex == NULL && lcache->grid_tx.data) {
    lcache->grid_tx.tex = GPU_texture_create_nD(lcache->grid_tx.tex_size[0],
                                                lcache->grid_tx.tex_size[1],
                                                lcache->grid_tx.tex_size[2],
                                                2,
                                                lcache->grid_tx.data,
                                                IRRADIANCE_FORMAT,
                                                GPU_DATA_UNSIGNED_BYTE,
                                                0,
                                                false,
                                                NULL);
    GPU_texture_bind(lcache->grid_tx.tex, 0);
    GPU_texture_filter_mode(lcache->grid_tx.tex, true);
    GPU_texture_unbind(lcache->grid_tx.tex);
  }

  if (lcache->cube_tx.tex == NULL && lcache->cube_tx.data) {
    lcache->cube_tx.tex = GPU_texture_create_nD(lcache->cube_tx.tex_size[0],
                                                lcache->cube_tx.tex_size[1],
                                                lcache->cube_tx.tex_size[2],
                                                2,
                                                lcache->cube_tx.data,
                                                GPU_R11F_G11F_B10F,
                                                GPU_DATA_10_11_11_REV,
                                                0,
                                                false,
                                                NULL);
    GPU_texture_bind(lcache->cube_tx.tex, 0);
    GPU_texture_mipmap_mode(lcache->cube_tx.tex, true, true);
    for (int mip = 0; mip < lcache->mips_len; ++mip) {
      GPU_texture_add_mipmap(
          lcache->cube_tx.tex, GPU_DATA_10_11_11_REV, mip + 1, lcache->cube_mips[mip].data);
    }
    GPU_texture_unbind(lcache->cube_tx.tex);
  }
}
Beispiel #9
0
/**
 * A shadow map for VSM needs two components (depth and depth^2)
 */
GPUTexture *GPU_texture_create_vsm_shadow_map(int size, char err_out[256])
{
	GPUTexture *tex = GPU_texture_create_nD(size, size, 2, NULL, 0, GPU_HDR_FULL_FLOAT, 2, 0, err_out);

	if (tex) {
		/* Now we tweak some of the settings */
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

		GPU_texture_unbind(tex);
	}

	return tex;
}
Beispiel #10
0
GPUTexture *GPU_texture_create_1D_procedural(int w, const float *pixels, char err_out[256])
{
	GPUTexture *tex = GPU_texture_create_nD(w, 0, 1, pixels, 0, GPU_HDR_HALF_FLOAT, 2, 0, err_out);

	if (tex) {
		/* Now we tweak some of the settings */
		glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_REPEAT);
		glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
		glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);

		GPU_texture_unbind(tex);
	}

	return tex;
}