diff options
| author | 2019-12-20 22:51:19 -0300 | |
|---|---|---|
| committer | 2019-12-20 22:51:21 -0300 | |
| commit | 1e16023d6000395b71e1a5d00e38e84bade12f20 (patch) | |
| tree | 388adb52f131cbfe7fb7ba291f7acaa9cc59b8ea /src | |
| parent | gl_shader_cache: Remove unused entry in GetPrimitiveDescription (diff) | |
| download | yuzu-1e16023d6000395b71e1a5d00e38e84bade12f20.tar.gz yuzu-1e16023d6000395b71e1a5d00e38e84bade12f20.tar.xz yuzu-1e16023d6000395b71e1a5d00e38e84bade12f20.zip | |
gl_shader_cache: Update commentary for shared memory
Remove false commentary. Not dividing by 4 the size of shared memory is
not a hack; it describes the number of integers, not bytes.
While we are at it sort the generated code to put preprocessor lines on
the top.
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_shader_cache.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_cache.cpp b/src/video_core/renderer_opengl/gl_shader_cache.cpp index c2ec120ba..de742d11c 100644 --- a/src/video_core/renderer_opengl/gl_shader_cache.cpp +++ b/src/video_core/renderer_opengl/gl_shader_cache.cpp | |||
| @@ -264,28 +264,25 @@ CachedProgram BuildShader(const Device& device, u64 unique_identifier, ShaderTyp | |||
| 264 | "#extension GL_NV_shader_thread_group : require\n" | 264 | "#extension GL_NV_shader_thread_group : require\n" |
| 265 | "#extension GL_NV_shader_thread_shuffle : require\n"; | 265 | "#extension GL_NV_shader_thread_shuffle : require\n"; |
| 266 | } | 266 | } |
| 267 | source += '\n'; | ||
| 268 | 267 | ||
| 269 | if (shader_type == ShaderType::Geometry) { | 268 | if (shader_type == ShaderType::Geometry) { |
| 270 | const auto [glsl_topology, max_vertices] = GetPrimitiveDescription(variant.primitive_mode); | 269 | const auto [glsl_topology, max_vertices] = GetPrimitiveDescription(variant.primitive_mode); |
| 271 | source += fmt::format("#define MAX_VERTEX_INPUT {}\n", max_vertices); | 270 | source += fmt::format("#define MAX_VERTEX_INPUT {}\n", max_vertices); |
| 272 | source += fmt::format("layout ({}) in;\n\n", glsl_topology); | 271 | source += fmt::format("layout ({}) in;\n", glsl_topology); |
| 273 | } | 272 | } |
| 274 | if (shader_type == ShaderType::Compute) { | 273 | if (shader_type == ShaderType::Compute) { |
| 274 | if (variant.local_memory_size > 0) { | ||
| 275 | source += fmt::format("#define LOCAL_MEMORY_SIZE {}\n", | ||
| 276 | Common::AlignUp(variant.local_memory_size, 4) / 4); | ||
| 277 | } | ||
| 275 | source += | 278 | source += |
| 276 | fmt::format("layout (local_size_x = {}, local_size_y = {}, local_size_z = {}) in;\n", | 279 | fmt::format("layout (local_size_x = {}, local_size_y = {}, local_size_z = {}) in;\n", |
| 277 | variant.block_x, variant.block_y, variant.block_z); | 280 | variant.block_x, variant.block_y, variant.block_z); |
| 278 | 281 | ||
| 279 | if (variant.shared_memory_size > 0) { | 282 | if (variant.shared_memory_size > 0) { |
| 280 | // TODO(Rodrigo): We should divide by four here, but having a larger shared memory pool | 283 | // shared_memory_size is described in number of words |
| 281 | // avoids out of bound stores. Find out why shared memory size is being invalid. | ||
| 282 | source += fmt::format("shared uint smem[{}];\n", variant.shared_memory_size); | 284 | source += fmt::format("shared uint smem[{}];\n", variant.shared_memory_size); |
| 283 | } | 285 | } |
| 284 | |||
| 285 | if (variant.local_memory_size > 0) { | ||
| 286 | source += fmt::format("#define LOCAL_MEMORY_SIZE {}\n", | ||
| 287 | Common::AlignUp(variant.local_memory_size, 4) / 4); | ||
| 288 | } | ||
| 289 | } | 286 | } |
| 290 | 287 | ||
| 291 | source += '\n'; | 288 | source += '\n'; |