[Bf-blender-cvs] [775c4eb903e] blender2.8: OpenSubdiv: Remove one more unused file

Sergey Sharybin noreply at git.blender.org
Mon Jul 16 12:34:58 CEST 2018


Commit: 775c4eb903ef7ed23e734a2412b96d1bf2126e8f
Author: Sergey Sharybin
Date:   Mon Jul 16 12:34:19 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB775c4eb903ef7ed23e734a2412b96d1bf2126e8f

OpenSubdiv: Remove one more unused file

===================================================================

D	intern/opensubdiv/internal/opensubdiv_gpu.cc

===================================================================

diff --git a/intern/opensubdiv/internal/opensubdiv_gpu.cc b/intern/opensubdiv/internal/opensubdiv_gpu.cc
deleted file mode 100644
index d28b48ddd18..00000000000
--- a/intern/opensubdiv/internal/opensubdiv_gpu.cc
+++ /dev/null
@@ -1,788 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2013 Blender Foundation.
- * All rights reserved.
- *
- * Contributor(s): Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-#include "opensubdiv_capi.h"
-
-#ifdef _MSC_VER
-#  include "iso646.h"
-#endif
-
-#include <cstdio>
-#include <cmath>
-#include <GL/glew.h>
-
-#include <opensubdiv/osd/glMesh.h>
-
-#ifdef OPENSUBDIV_HAS_CUDA
-#  include <opensubdiv/osd/cudaGLVertexBuffer.h>
-#endif  /* OPENSUBDIV_HAS_CUDA */
-
-#include <opensubdiv/osd/cpuGLVertexBuffer.h>
-#include <opensubdiv/osd/cpuEvaluator.h>
-
-#include "MEM_guardedalloc.h"
-
-#include "opensubdiv_capi.h"
-#include "opensubdiv_gl_mesh.h"
-#include "opensubdiv_topology_refiner.h"
-
-using OpenSubdiv::Osd::GLMeshInterface;
-
-extern "C" char datatoc_gpu_shader_opensubdiv_vertex_glsl[];
-extern "C" char datatoc_gpu_shader_opensubdiv_geometry_glsl[];
-extern "C" char datatoc_gpu_shader_opensubdiv_fragment_glsl[];
-
-/* TODO(sergey): This is bit of bad level calls :S */
-extern "C" {
-void copy_m3_m3(float m1[3][3], float m2[3][3]);
-void copy_m3_m4(float m1[3][3], float m2[4][4]);
-void adjoint_m3_m3(float m1[3][3], float m[3][3]);
-float determinant_m3_array(float m[3][3]);
-bool invert_m3_m3(float m1[3][3], float m2[3][3]);
-bool invert_m3(float m[3][3]);
-void transpose_m3(float mat[3][3]);
-}
-
-#define MAX_LIGHTS 8
-#define SUPPORT_COLOR_MATERIAL
-
-typedef struct Light {
-	float position[4];
-	float ambient[4];
-	float diffuse[4];
-	float specular[4];
-	float spot_direction[4];
-#ifdef SUPPORT_COLOR_MATERIAL
-	float constant_attenuation;
-	float linear_attenuation;
-	float quadratic_attenuation;
-	float spot_cutoff;
-	float spot_exponent;
-	float spot_cos_cutoff;
-	float pad, pad2;
-#endif
-} Light;
-
-typedef struct Lighting {
-	Light lights[MAX_LIGHTS];
-	int num_enabled;
-} Lighting;
-
-typedef struct Transform {
-	float projection_matrix[16];
-	float model_view_matrix[16];
-	float normal_matrix[9];
-} Transform;
-
-static bool g_use_osd_glsl = false;
-static int g_active_uv_index = 0;
-
-static GLuint g_flat_fill_solid_program = 0;
-static GLuint g_flat_fill_texture2d_program = 0;
-static GLuint g_smooth_fill_solid_program = 0;
-static GLuint g_smooth_fill_texture2d_program = 0;
-
-static GLuint g_flat_fill_solid_shadeless_program = 0;
-static GLuint g_flat_fill_texture2d_shadeless_program = 0;
-static GLuint g_smooth_fill_solid_shadeless_program = 0;
-static GLuint g_smooth_fill_texture2d_shadeless_program = 0;
-
-static GLuint g_wireframe_program = 0;
-
-static GLuint g_lighting_ub = 0;
-static Lighting g_lighting_data;
-static Transform g_transform;
-
-struct OpenSubdiv_GLMeshFVarData
-{
-	OpenSubdiv_GLMeshFVarData() :
-		texture_buffer(0), offset_buffer(0) {
-	}
-
-	~OpenSubdiv_GLMeshFVarData()
-	{
-		Release();
-	}
-
-	void Release()
-	{
-		if (texture_buffer) {
-			glDeleteTextures(1, &texture_buffer);
-		}
-		if (offset_buffer) {
-			glDeleteTextures(1, &offset_buffer);
-		}
-		texture_buffer = 0;
-		offset_buffer = 0;
-		fvar_width = 0;
-		channel_offsets.clear();
-	}
-
-	void Create(const OpenSubdiv::Far::TopologyRefiner *refiner,
-	            const OpenSubdiv::Far::PatchTable *patch_table,
-	            int fvar_width,
-	            const float *fvar_src_data)
-	{
-		Release();
-
-		this->fvar_width = fvar_width;
-
-		/* Expand fvar data to per-patch array */
-		const int max_level = refiner->GetMaxLevel();
-		const int num_channels = patch_table->GetNumFVarChannels();
-		std::vector<float> data;
-		int fvar_data_offset = 0;
-		channel_offsets.resize(num_channels);
-		for (int channel = 0; channel < num_channels; ++channel) {
-			OpenSubdiv::Far::ConstIndexArray indices =
-			        patch_table->GetFVarValues(channel);
-
-			channel_offsets[channel] = data.size();
-			data.reserve(data.size() + indices.size() * fvar_width);
-
-			for (int fvert = 0; fvert < (int)indices.size(); ++fvert) {
-				int index = indices[fvert] * fvar_width;
-				for (int i = 0; i < fvar_width; ++i) {
-					data.push_back(fvar_src_data[fvar_data_offset + index++]);
-				}
-			}
-			if (refiner->IsUniform()) {
-				const int num_values_max = refiner->GetLevel(max_level).GetNumFVarValues(channel);
-				fvar_data_offset += num_values_max * fvar_width;
-			} else {
-				const int num_values_total = refiner->GetNumFVarValuesTotal(channel);
-				fvar_data_offset += num_values_total * fvar_width;
-			}
-		}
-
-		GLuint buffer;
-		glGenBuffers(1, &buffer);
-		glBindBuffer(GL_ARRAY_BUFFER, buffer);
-		glBufferData(GL_ARRAY_BUFFER, data.size()*sizeof(float),
-		             &data[0], GL_STATIC_DRAW);
-
-		glGenTextures(1, &texture_buffer);
-		glBindTexture(GL_TEXTURE_BUFFER, texture_buffer);
-		glTexBuffer(GL_TEXTURE_BUFFER, GL_R32F, buffer);
-
-		glDeleteBuffers(1, &buffer);
-
-		glGenBuffers(1, &buffer);
-		glBindBuffer(GL_ARRAY_BUFFER, buffer);
-		glBufferData(GL_ARRAY_BUFFER, channel_offsets.size()*sizeof(int),
-		             &channel_offsets[0], GL_STATIC_DRAW);
-
-		glGenTextures(1, &offset_buffer);
-		glBindTexture(GL_TEXTURE_BUFFER, offset_buffer);
-		glTexBuffer(GL_TEXTURE_BUFFER, GL_R32I, buffer);
-		glBindTexture(GL_TEXTURE_BUFFER, 0);
-		glBindBuffer(GL_ARRAY_BUFFER, 0);
-	}
-	GLuint texture_buffer;
-	GLuint offset_buffer;
-	std::vector<int> channel_offsets;
-	int fvar_width;
-};
-
-namespace {
-
-GLuint compileShader(GLenum shaderType,
-                     const char *version,
-                     const char *define,
-                     const char *source)
-{
-	const char *sources[] = {
-		version,
-		define,
-#ifdef SUPPORT_COLOR_MATERIAL
-		"#define SUPPORT_COLOR_MATERIAL\n",
-#else
-		"",
-#endif
-		source,
-	};
-
-	GLuint shader = glCreateShader(shaderType);
-	glShaderSource(shader, 4, sources, NULL);
-	glCompileShader(shader);
-
-	GLint status;
-	glGetShaderiv(shader, GL_COMPILE_STATUS, &status);
-	if (status == GL_FALSE) {
-		GLchar emsg[1024];
-		glGetShaderInfoLog(shader, sizeof(emsg), 0, emsg);
-		fprintf(stderr, "Error compiling GLSL: %s\n", emsg);
-		fprintf(stderr, "Version: %s\n", version);
-		fprintf(stderr, "Defines: %s\n", define);
-		fprintf(stderr, "Source: %s\n", source);
-		return 0;
-	}
-
-	return shader;
-}
-
-GLuint linkProgram(const char *version, const char *define)
-{
-	GLuint vertexShader = compileShader(GL_VERTEX_SHADER,
-	                                    version,
-	                                    define,
-	                                    datatoc_gpu_shader_opensubdiv_vertex_glsl);
-	if (vertexShader == 0) {
-		return 0;
-	}
-	GLuint geometryShader = compileShader(GL_GEOMETRY_SHADER,
-	                                      version,
-	                                      define,
-	                                      datatoc_gpu_shader_opensubdiv_geometry_glsl);
-	if (geometryShader == 0) {
-		return 0;
-	}
-	GLuint fragmentShader = compileShader(GL_FRAGMENT_SHADER,
-	                                      version,
-	                                      define,
-	                                      datatoc_gpu_shader_opensubdiv_fragment_glsl );
-	if (fragmentShader == 0) {
-		return 0;
-	}
-
-	GLuint program = glCreateProgram();
-
-	glAttachShader(program, vertexShader);
-	glAttachShader(program, geometryShader);
-	glAttachShader(program, fragmentShader);
-
-	glBindAttribLocation(program, 0, "position");
-	glBindAttribLocation(program, 1, "normal");
-
-	glLinkProgram(program);
-
-	glDeleteShader(vertexShader);
-	glDeleteShader(geometryShader);
-	glDeleteShader(fragmentShader);
-
-	GLint status;
-	glGetProgramiv(program, GL_LINK_STATUS, &status);
-	if (status == GL_FALSE) {
-		GLchar emsg[1024];
-		glGetProgramInfoLog(program, sizeof(emsg), 0, emsg);
-		fprintf(stderr, "Error linking GLSL program : %s\n", emsg);
-		fprintf(stderr, "Defines: %s\n", define);
-		glDeleteProgram(program);
-		return 0;
-	}
-
-	glUniformBlockBinding(program,
-	                      glGetUniformBlockIndex(program, "Lighting"),
-	                      0);
-
-	if (GLEW_VERSION_4_1) {
-		glProgramUniform1i(program,
-		                   glGetUniformLocation(program, "texture_buffer"),
-		                   0);  /* GL_TEXTURE0 */
-
-		glProgramUniform1i(program,
-		                   glGetUniformLocation(program, "FVarDataOffsetBuffer"),
-		                   30);  /* GL_TEXTURE30 */
-
-		glProgramUniform1i(program,
-		                   glGetUniformLocation(program, "FVarDataBuffer"),
-		                   31);  /* GL_TEXTURE31 */
-	}
-	else {
-		glUseProgram(program);
-		glUniform1i(glGetUniformLocation(program, "texture_buffer"), 0);  /* GL_TEXTURE0 */
-		glUniform1i(glGetUniformLocation(program, "FVarDataOffsetBuffer"), 30);  /* GL_TEXTURE30 */
-		glUniform1i(glGetUniformLocation(program, "FVarDataBuffer"), 31);  /* GL_TEXTURE31 */
-		glUseProgram(0);
-	}
-
-	return program;
-}
-
-void bindProgram(OpenSubdiv_GLMesh *gl_mesh, int program)
-{
-	glUseProgram(program);
-
-	/* Matrices */
-	glUniformMatrix4fv(glGetUniformLocation(program, "modelViewMatrix"),
-	                   1, false,
-	                   g_transform.model_view_matrix);
-	glUniformMatrix4fv(glGetUniformLocation(program, "projectionMatrix"),
-	                   1, false,
-	                   g_transform.projection_matrix);
-	glUniformMatri

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list