diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-09-12 15:30:28 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-09-12 15:30:28 +0300 |
commit | 39fabaddfd770f7d92a5aabb0d0255d6fc97cd24 (patch) | |
tree | d44e6c37094e53287596f33ecf8423eec8e7c51b /source/blender/gpu/intern/gpu_shader.c | |
parent | 721c691a2750d9eb005343a9d2e25fdac6ff1493 (diff) |
GPU: Remove residue of OpenSubdiv
Was done more like a hack on top of old drawing pipeline.
Should be re-implemented to fit new draw manager closer.
Diffstat (limited to 'source/blender/gpu/intern/gpu_shader.c')
-rw-r--r-- | source/blender/gpu/intern/gpu_shader.c | 81 |
1 files changed, 2 insertions, 79 deletions
diff --git a/source/blender/gpu/intern/gpu_shader.c b/source/blender/gpu/intern/gpu_shader.c index 803a6319017..55ba862548e 100644 --- a/source/blender/gpu/intern/gpu_shader.c +++ b/source/blender/gpu/intern/gpu_shader.c @@ -246,9 +246,7 @@ static void gpu_shader_standard_extensions(char defines[MAX_EXT_DEFINE_LENGTH]) } } -static void gpu_shader_standard_defines( - char defines[MAX_DEFINE_LENGTH], - bool use_opensubdiv) +static void gpu_shader_standard_defines(char defines[MAX_DEFINE_LENGTH]) { /* some useful defines to detect GPU type */ if (GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_ANY, GPU_DRIVER_ANY)) @@ -258,28 +256,6 @@ static void gpu_shader_standard_defines( else if (GPU_type_matches(GPU_DEVICE_INTEL, GPU_OS_ANY, GPU_DRIVER_ANY)) strcat(defines, "#define GPU_INTEL\n"); -#ifdef WITH_OPENSUBDIV - /* TODO(sergey): Check whether we actually compiling shader for - * the OpenSubdiv mesh. - */ - if (use_opensubdiv) { - strcat(defines, "#define USE_OPENSUBDIV\n"); - - /* TODO(sergey): not strictly speaking a define, but this is - * a global typedef which we don't have better place to define - * in yet. - */ - strcat(defines, - "struct VertexData {\n" - " vec4 position;\n" - " vec3 normal;\n" - " vec2 uv;" - "};\n"); - } -#else - UNUSED_VARS(use_opensubdiv); -#endif - return; } @@ -297,7 +273,6 @@ GPUShader *GPU_shader_create( geocode, libcode, defines, - GPU_SHADER_FLAGS_NONE, GPU_SHADER_TFB_NONE, NULL, 0, @@ -357,18 +332,11 @@ GPUShader *GPU_shader_create_ex( const char *geocode, const char *libcode, const char *defines, - const int flags, const GPUShaderTFBType tf_type, const char **tf_names, const int tf_count, const char *shname) { -#ifdef WITH_OPENSUBDIV - bool use_opensubdiv = (flags & GPU_SHADER_FLAGS_SPECIAL_OPENSUBDIV) != 0; -#else - UNUSED_VARS(flags); - bool use_opensubdiv = false; -#endif GLint status; GLchar log[5000]; GLsizei length = 0; @@ -404,9 +372,7 @@ GPUShader *GPU_shader_create_ex( return NULL; } - gpu_shader_standard_defines( - standard_defines, - use_opensubdiv); + gpu_shader_standard_defines(standard_defines); gpu_shader_standard_extensions(standard_extensions); if (vertexcode) { @@ -446,19 +412,6 @@ GPUShader *GPU_shader_create_ex( source[num_source++] = standard_extensions; source[num_source++] = standard_defines; -#ifdef WITH_OPENSUBDIV - /* TODO(sergey): Move to fragment shader source code generation. */ - if (use_opensubdiv) { - source[num_source++] = ( - "#ifdef USE_OPENSUBDIV\n" - "in block {\n" - " VertexData v;\n" - "} inpt;\n" - "#endif\n" - ); - } -#endif - if (defines) source[num_source++] = defines; if (libcode) source[num_source++] = libcode; source[num_source++] = fragcode; @@ -508,13 +461,6 @@ GPUShader *GPU_shader_create_ex( } } -#ifdef WITH_OPENSUBDIV - if (use_opensubdiv) { - glBindAttribLocation(shader->program, 0, "position"); - glBindAttribLocation(shader->program, 1, "normal"); - } -#endif - if (tf_names != NULL) { glTransformFeedbackVaryings(shader->program, tf_count, tf_names, GL_INTERLEAVED_ATTRIBS); /* Primitive type must be setup */ @@ -538,29 +484,6 @@ GPUShader *GPU_shader_create_ex( shader->interface = GPU_shaderinterface_create(shader->program); -#ifdef WITH_OPENSUBDIV - /* TODO(sergey): Find a better place for this. */ - if (use_opensubdiv) { - if (GLEW_VERSION_4_1) { - glProgramUniform1i( - shader->program, - GPU_shaderinterface_uniform(shader->interface, "FVarDataOffsetBuffer")->location, - 30); /* GL_TEXTURE30 */ - - glProgramUniform1i( - shader->program, - GPU_shaderinterface_uniform(shader->interface, "FVarDataBuffer")->location, - 31); /* GL_TEXTURE31 */ - } - else { - glUseProgram(shader->program); - glUniform1i(GPU_shaderinterface_uniform(shader->interface, "FVarDataOffsetBuffer")->location, 30); - glUniform1i(GPU_shaderinterface_uniform(shader->interface, "FVarDataBuffer")->location, 31); - glUseProgram(0); - } - } -#endif - return shader; } |