[Bf-blender-cvs] [aac73d1a7b2] temp-gpu-compute-shaders: Merge branch 'temp-gpu-compute-shaders' of git.blender.org:blender into temp-gpu-compute-shaders

Jeroen Bakker noreply at git.blender.org
Fri Apr 23 10:26:21 CEST 2021


Commit: aac73d1a7b22c0295a1d14e3146ef1fab2501b53
Author: Jeroen Bakker
Date:   Fri Apr 9 08:08:08 2021 +0200
Branches: temp-gpu-compute-shaders
https://developer.blender.org/rBaac73d1a7b22c0295a1d14e3146ef1fab2501b53

Merge branch 'temp-gpu-compute-shaders' of git.blender.org:blender into temp-gpu-compute-shaders

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



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

diff --cc source/blender/gpu/intern/gpu_compute.cc
index f6f70be5efb,4befa1c62ee..e07a17d14a4
--- a/source/blender/gpu/intern/gpu_compute.cc
+++ b/source/blender/gpu/intern/gpu_compute.cc
@@@ -19,7 -19,7 +19,8 @@@
   */
  
  #include "GPU_compute.h"
- #include "GPU_context.h"
++
+ #include "gpu_backend.hh"
  
  #ifdef __cplusplus
  extern "C" {
diff --cc source/blender/gpu/tests/gpu_shader_test.cc
index c693d985370,d1dbdf6efef..957210e2e40
--- a/source/blender/gpu/tests/gpu_shader_test.cc
+++ b/source/blender/gpu/tests/gpu_shader_test.cc
@@@ -15,8 -17,7 +15,6 @@@ namespace blender::gpu::tests 
  
  TEST_F(GPUTest, gpu_shader_compute)
  {
-   static constexpr int WIDTH = 512;
-   static constexpr int HEIGHT = 512;
 -  static constexpr int SIZE = 512;
  
    if (!GPU_compute_shader_support()) {
      /* We can't test as a the platform does not support compute shaders. */
@@@ -24,18 -25,17 +22,18 @@@
      return;
    }
  
++  static constexpr int SIZE = 512;
    const char *compute_glsl = R"(
  
- uniform float roll;
- uniform writeonly image2D destTex;
- layout (local_size_x = 16, local_size_y = 16) in;
+ layout(local_size_x = 1, local_size_y = 1) in;
+ layout(rgba32f, binding = 0) uniform image1D img_output;
  
  void main() {
-     ivec2 storePos = ivec2(gl_GlobalInvocationID.xy);
-     float localCoef = length(vec2(ivec2(gl_LocalInvocationID.xy)-8)/8.0);
-     float globalCoef = sin(float(gl_WorkGroupID.x+gl_WorkGroupID.y)*0.1 + roll)*0.5;
-     imageStore(destTex, storePos, vec4(1.0-globalCoef*localCoef, 0.0, 0.0, 0.0));
- }
+   // base pixel colour for image
+   vec4 pixel = vec4(1.0, 0.5, 0.2, 1.0);
+   
+   // output to a specific pixel in the image
+   imageStore(img_output, int(gl_GlobalInvocationID.x), pixel);}
  
  )";
  
diff --cc source/blender/gpu/tests/gpu_testing.cc
index c193a19ad9c,c193a19ad9c..b9fc78dc084
--- a/source/blender/gpu/tests/gpu_testing.cc
+++ b/source/blender/gpu/tests/gpu_testing.cc
@@@ -15,7 -15,7 +15,7 @@@ void GPUTest::SetUp(
    GHOST_GLSettings glSettings = {0};
    ghost_system = GHOST_CreateSystem();
    ghost_context = GHOST_CreateOpenGLContext(ghost_system, glSettings);
--  context = GPU_context_create(NULL);
++  context = GPU_context_create(nullptr);
    GPU_init();
  }



More information about the Bf-blender-cvs mailing list