Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen Bakker <jeroen@blender.org>2021-07-09 11:11:01 +0300
committerJeroen Bakker <jeroen@blender.org>2021-07-09 11:11:01 +0300
commit1259271a78e4d201feed53b8e00adb27057a8afb (patch)
tree75bb7291d6d531233761a239c66e172b1bb36fc7
parentb60e61396b7b4bc54f4e628118586ab168775671 (diff)
More renaming.
-rw-r--r--source/blender/gpu/CMakeLists.txt2
-rw-r--r--source/blender/gpu/intern/gpu_shader_block.cc64
-rw-r--r--source/blender/gpu/intern/gpu_shader_block.hh4
-rw-r--r--source/blender/gpu/opengl/gl_shader_interface.cc2
-rw-r--r--source/blender/gpu/tests/gpu_shader_block_test.cc (renamed from source/blender/gpu/tests/gpu_uniform_buffer_struct_test.cc)10
5 files changed, 41 insertions, 41 deletions
diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt
index 267cda4f38a..53570c64ab0 100644
--- a/source/blender/gpu/CMakeLists.txt
+++ b/source/blender/gpu/CMakeLists.txt
@@ -401,7 +401,7 @@ if(WITH_GTESTS)
tests/gpu_index_buffer_test.cc
tests/gpu_shader_builtin_test.cc
tests/gpu_shader_test.cc
- tests/gpu_uniform_buffer_struct_test.cc
+ tests/gpu_shader_block_test.cc
tests/gpu_testing.hh
)
diff --git a/source/blender/gpu/intern/gpu_shader_block.cc b/source/blender/gpu/intern/gpu_shader_block.cc
index a10bf4a332c..c78e73c2057 100644
--- a/source/blender/gpu/intern/gpu_shader_block.cc
+++ b/source/blender/gpu/intern/gpu_shader_block.cc
@@ -55,30 +55,30 @@ static bool is_valid_location(int location)
return true;
}
-static constexpr ShaderBlockType::AttributeBinding determine_binding_struct_1(
+static constexpr ShaderBlockType::AttributeBinding determine_location_3d_color(
const GPUUniformBuiltin builtin_uniform)
{
ShaderBlockType::AttributeBinding result = {-1, 0};
switch (builtin_uniform) {
case GPU_UNIFORM_MODEL:
- result.binding = to_binding_location(builtin_uniform);
+ result.location = to_binding_location(builtin_uniform);
result.offset = offsetof(GPUShaderBlock3dColor, ModelMatrix);
break;
case GPU_UNIFORM_MVP:
- result.binding = to_binding_location(builtin_uniform);
+ result.location = to_binding_location(builtin_uniform);
result.offset = offsetof(GPUShaderBlock3dColor, ModelViewProjectionMatrix);
break;
case GPU_UNIFORM_COLOR:
- result.binding = to_binding_location(builtin_uniform);
+ result.location = to_binding_location(builtin_uniform);
result.offset = offsetof(GPUShaderBlock3dColor, color);
break;
case GPU_UNIFORM_CLIPPLANES:
- result.binding = to_binding_location(builtin_uniform);
+ result.location = to_binding_location(builtin_uniform);
result.offset = offsetof(GPUShaderBlock3dColor, WorldClipPlanes);
break;
case GPU_UNIFORM_SRGB_TRANSFORM:
- result.binding = to_binding_location(builtin_uniform);
+ result.location = to_binding_location(builtin_uniform);
result.offset = offsetof(GPUShaderBlock3dColor, SrgbTransform);
break;
@@ -90,43 +90,43 @@ static constexpr ShaderBlockType::AttributeBinding determine_binding_struct_1(
}
static constexpr ShaderBlockType::AttributeBinding determine_binding(
- const GPUShaderBlockType struct_type, const GPUUniformBuiltin builtin_uniform)
+ const GPUShaderBlockType block_type, const GPUUniformBuiltin builtin_uniform)
{
- switch (struct_type) {
+ switch (block_type) {
case GPU_SHADER_BLOCK_CUSTOM:
case GPU_NUM_SHADER_BLOCK_TYPES:
return {};
case GPU_SHADER_BLOCK_3D_COLOR:
- return determine_binding_struct_1(builtin_uniform);
+ return determine_location_3d_color(builtin_uniform);
};
return {};
}
static constexpr std::array<const ShaderBlockType::AttributeBinding, GPU_NUM_UNIFORMS>
-builtin_uniforms_for_struct_type(const GPUShaderBlockType struct_type)
+builtin_uniforms_for_struct_type(const GPUShaderBlockType block_type)
{
return {
- determine_binding(struct_type, GPU_UNIFORM_MODEL),
- determine_binding(struct_type, GPU_UNIFORM_VIEW),
- determine_binding(struct_type, GPU_UNIFORM_MODELVIEW),
- determine_binding(struct_type, GPU_UNIFORM_PROJECTION),
- determine_binding(struct_type, GPU_UNIFORM_VIEWPROJECTION),
- determine_binding(struct_type, GPU_UNIFORM_MVP),
- determine_binding(struct_type, GPU_UNIFORM_MODEL_INV),
- determine_binding(struct_type, GPU_UNIFORM_VIEW_INV),
- determine_binding(struct_type, GPU_UNIFORM_MODELVIEW_INV),
- determine_binding(struct_type, GPU_UNIFORM_PROJECTION_INV),
- determine_binding(struct_type, GPU_UNIFORM_VIEWPROJECTION_INV),
- determine_binding(struct_type, GPU_UNIFORM_NORMAL),
- determine_binding(struct_type, GPU_UNIFORM_ORCO),
- determine_binding(struct_type, GPU_UNIFORM_CLIPPLANES),
- determine_binding(struct_type, GPU_UNIFORM_COLOR),
- determine_binding(struct_type, GPU_UNIFORM_BASE_INSTANCE),
- determine_binding(struct_type, GPU_UNIFORM_RESOURCE_CHUNK),
- determine_binding(struct_type, GPU_UNIFORM_RESOURCE_ID),
- determine_binding(struct_type, GPU_UNIFORM_SRGB_TRANSFORM),
+ determine_binding(block_type, GPU_UNIFORM_MODEL),
+ determine_binding(block_type, GPU_UNIFORM_VIEW),
+ determine_binding(block_type, GPU_UNIFORM_MODELVIEW),
+ determine_binding(block_type, GPU_UNIFORM_PROJECTION),
+ determine_binding(block_type, GPU_UNIFORM_VIEWPROJECTION),
+ determine_binding(block_type, GPU_UNIFORM_MVP),
+ determine_binding(block_type, GPU_UNIFORM_MODEL_INV),
+ determine_binding(block_type, GPU_UNIFORM_VIEW_INV),
+ determine_binding(block_type, GPU_UNIFORM_MODELVIEW_INV),
+ determine_binding(block_type, GPU_UNIFORM_PROJECTION_INV),
+ determine_binding(block_type, GPU_UNIFORM_VIEWPROJECTION_INV),
+ determine_binding(block_type, GPU_UNIFORM_NORMAL),
+ determine_binding(block_type, GPU_UNIFORM_ORCO),
+ determine_binding(block_type, GPU_UNIFORM_CLIPPLANES),
+ determine_binding(block_type, GPU_UNIFORM_COLOR),
+ determine_binding(block_type, GPU_UNIFORM_BASE_INSTANCE),
+ determine_binding(block_type, GPU_UNIFORM_RESOURCE_CHUNK),
+ determine_binding(block_type, GPU_UNIFORM_RESOURCE_ID),
+ determine_binding(block_type, GPU_UNIFORM_SRGB_TRANSFORM),
};
}
@@ -138,10 +138,10 @@ static constexpr std::array<
builtin_uniforms_for_struct_type(GPU_SHADER_BLOCK_3D_COLOR),
};
-static constexpr size_t data_size_for(const GPUShaderBlockType struct_type)
+static constexpr size_t data_size_for(const GPUShaderBlockType block_type)
{
- switch (struct_type) {
+ switch (block_type) {
case GPU_SHADER_BLOCK_CUSTOM:
case GPU_NUM_SHADER_BLOCK_TYPES:
return 0;
@@ -165,7 +165,7 @@ constexpr ShaderBlockType::ShaderBlockType(const GPUShaderBlockType type)
bool ShaderBlockType::AttributeBinding::has_binding() const
{
- return binding != -1;
+ return location != -1;
}
bool ShaderBlockType::has_all_builtin_uniforms(const ShaderInterface &interface) const
diff --git a/source/blender/gpu/intern/gpu_shader_block.hh b/source/blender/gpu/intern/gpu_shader_block.hh
index 95e8524a334..014dd9d2def 100644
--- a/source/blender/gpu/intern/gpu_shader_block.hh
+++ b/source/blender/gpu/intern/gpu_shader_block.hh
@@ -13,7 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Copyright 2020, Blender Foundation.
+ * Copyright 2021, Blender Foundation.
*/
/** \file
@@ -42,7 +42,7 @@ class ShaderBlockType {
GPUShaderBlockType type;
struct AttributeBinding {
- int binding = -1;
+ int location = -1;
size_t offset = 0;
bool has_binding() const;
diff --git a/source/blender/gpu/opengl/gl_shader_interface.cc b/source/blender/gpu/opengl/gl_shader_interface.cc
index 23435a2e0ee..7925d039fc6 100644
--- a/source/blender/gpu/opengl/gl_shader_interface.cc
+++ b/source/blender/gpu/opengl/gl_shader_interface.cc
@@ -302,7 +302,7 @@ GLShaderInterface::GLShaderInterface(const ShaderBlockType *type_info, GLuint pr
builtin_uniform);
if (binding.has_binding()) {
ShaderInput *input = &inputs_[attr_len_ + ubo_len_ + uniform_len_++];
- input->location = binding.binding;
+ input->location = binding.location;
input->binding = -1;
char *name = name_buffer_ + name_buffer_offset;
diff --git a/source/blender/gpu/tests/gpu_uniform_buffer_struct_test.cc b/source/blender/gpu/tests/gpu_shader_block_test.cc
index 6bc5a0e2aed..a9e878b2391 100644
--- a/source/blender/gpu/tests/gpu_uniform_buffer_struct_test.cc
+++ b/source/blender/gpu/tests/gpu_shader_block_test.cc
@@ -25,7 +25,7 @@ TEST(GPUUniformStruct, struct1)
float m4[4][4];
unit_m4(m4);
- const bool result = uniform_struct.uniform_float(binding.binding, 4, 4, (const float *)m4);
+ const bool result = uniform_struct.uniform_float(binding.location, 4, 4, (const float *)m4);
EXPECT_TRUE(result);
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
@@ -41,7 +41,7 @@ TEST(GPUUniformStruct, struct1)
float m4[4][4];
unit_m4(m4);
- const bool result = uniform_struct.uniform_float(binding.binding, 4, 4, (const float *)m4);
+ const bool result = uniform_struct.uniform_float(binding.location, 4, 4, (const float *)m4);
EXPECT_TRUE(result);
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
@@ -55,7 +55,7 @@ TEST(GPUUniformStruct, struct1)
const ShaderBlockType::AttributeBinding &binding = type_info.attribute_binding(
GPU_UNIFORM_COLOR);
float color[4] = {1.0f, 0.0f, 1.0f, 1.0f};
- const bool result = uniform_struct.uniform_float(binding.binding, 4, 1, color);
+ const bool result = uniform_struct.uniform_float(binding.location, 4, 1, color);
EXPECT_TRUE(result);
for (int i = 0; i < 4; i++) {
EXPECT_EQ(struct_data->color[i], color[i]);
@@ -77,7 +77,7 @@ TEST(GPUUniformStruct, struct1)
};
const bool result = uniform_struct.uniform_float(
- binding.binding, 4, 6, (const float *)clip_planes);
+ binding.location, 4, 6, (const float *)clip_planes);
EXPECT_TRUE(result);
for (int i = 0; i < 6; i++) {
for (int j = 0; j < 4; j++) {
@@ -91,7 +91,7 @@ TEST(GPUUniformStruct, struct1)
const ShaderBlockType::AttributeBinding &binding = type_info.attribute_binding(
GPU_UNIFORM_SRGB_TRANSFORM);
int srgb_transform = true;
- const bool result = uniform_struct.uniform_int(binding.binding, 1, 1, &srgb_transform);
+ const bool result = uniform_struct.uniform_int(binding.location, 1, 1, &srgb_transform);
EXPECT_TRUE(result);
EXPECT_EQ(struct_data->SrgbTransform, srgb_transform);
}