Jump to content
  • Advertisement

Andrey OGL_D3D

  • Content count

  • Joined

  • Last visited

Community Reputation

2 Neutral

1 Follower

About Andrey OGL_D3D

  • Rank

Personal Information

  • Role
  • Interests


  • Github

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. OpenGL/Direct3D can share Buffers/textures with OpenCL using clCreateFromD3D11BufferKHR/clCreateFromGLBuffer, clCreateFromGLTexture/clCreateFromD3D11TextureXDKHR I think that any call clEnqueueAcquireGLObjects/clEnqueueReleaseGLObjects and clEnqueueAcquireD3D11ObjectsKHR/clEnqueueReleaseD3D11ObjectsKHR can be decrease performance. But I have no complete information about it. I will try to use notification using clCreateUserEvent/clSetEventCallback instaded of clWaitForEvents. Also may be we need to know where the performance can be decreased using CL_QUEUE_PROFILING_ENABLE. What do you think ? But we should use the separate code(GLSL/HLSL compute shaders) for different API, if we need to support OpenGL/Direct3D11. But SPIR-V can be help to use common code in this case. Have you done it without CL<->GL/D3D interop ? So, in some cases OpenCL can be faster than VK/GL/D3D compute shaders in case where we needn't share resources ? Thank for for your answers, it can help me to support GPU compute.
  2. JoeJ, thank you for your full information, with my point of view, i think the most decrease of performance during using OpenCL this is CPU/GPU communication, also the sharing graphics resources between OpenCL, am i right ? What do you think about the OpenCL future? for example Khronos has plans with unique Vulkan and OpenCL interoperability. I try to use OpenCL for my 3D Engine, but i have some decrease performance with using OpenCL for frustum culling and Indirect Drawing and simulation of particle system. nVidia has some OpenCL Driver bugs: https://devtalk.nvidia.com/default/topic/1035913/cuda-programming-and-performance/clcreatefromd3d11buffernv-returns-cl_invalid_d3d11_resource_nv-for-id3d11buffer-with-d3d11_resource_-/ But in some project still uses OpenCL: Bullet Physics, AMD Radeon Rays, AMD Pro Render
  3. Why ? do you have some test or other information ?
  4. printText() { ... glUniform1f(this->mZShaderHandle, 0.0f); ... } printTexture( { ... glUniform1f(this->mZShaderHandle, 0.5f); ... } printAll() { printText... printTexture... } It's time to try to create simple project for Windows :)) and attach it to github !
  5. Ok, Again it is my mistake: "#version 320 es\n" "layout (location = 0) in vec4 vertex;\n" "out vec2 TexCoords;\n" "uniform mat4 projection;\n" "uniform float z;\n" "void main() {\n" " gl_Position = projection * vec4(vertex.xy, z, 1.0);\n" " TexCoords = vertex.zw;\n" "}\n"
  6. const char gVertexShader[] = "#version 320 es\n" "layout (location = 0) in vec4 vertex;\n" "out vec2 TexCoords;\n" "uniform mat4 projection;\n" "uniform float z;\n" "void main() {\n" " gl_Position = projection * vec4(vertex.xy, z, 1.0);\n" " TexCoords = vertex.xy;\n" "}\n" Cluster::printTexture { glUniform1f(uniformHandleZ, 0.0f); } Cluster::printText { glUniform1f(uniformHandleZ, 0.5f); } // Order Rendering printTexture(...) printText(...) Also you should consider order rendering of texture/text
  7. Ok, i think you have Z-fighting problem. 1) You can set different Z coordinates for texture/font(additional uniform variable for vertex shader, 0.5 - for text, 0.0 - for texture) or use glPolygonOffset function. 2) also you can use glBlendFunc with Z-Write Disable.
  8. Hi, DevAndroid Can you show me expected result ? May be need to set some RenderState parameters ? "Z Write enable" "Z Test" ...?
  9. Hi, DevAndroid Sorry my mistakes! 1) Your shader and function printTexture(float vertices[6][4]) on first post is correct! 2) You can use single shader for text and texture printing. 3) Use separate VBO for texture and text, also you can use static buffer for print texture(Without glBufferSubData, only glBufferData during preparing vertices) Try it.
  10. The Branche in fragment shader can decrease performance, so separate shader program may be better, but "if/else" is simpler.
  11. yes, you should compile 2 vertex shader and one pixel shader, and link two separate program. Also you can use Separate Shader Objects(OpenGL ES 3.1 and above or EXT_separate_shader_objects) glUniform1i(textureIsFont, 1); glUseProgram(text); .... glUniform1i(textureIsFont, 0); glUseProgram(textureQuad); you can use uniform variable "#version 320 es\n" "layout (location = 0) in vec4 vertex;\n" "out vec2 TexCoords;\n" "uniform mat4 projection;\n" "uniform int textureIsFont;\n" "void main() {\n" " if (!textureIsFont) {\n" " gl_Position = projection * vec4(vertex.xy, 0.0, 1.0);\n" " TexCoords = vertex.xy;\n" " } else {\n" " gl_Position = projection * vec4(vertex.xy, 0.0, 1.0);\n" " TexCoords = vertex.zw;\n" " }" "}\n"
  12. Try to use separate vertex shader for texture printing: const char gVertexShader[] = "#version 320 es\n" "layout (location = 0) in vec4 vertex;\n" "out vec2 TexCoords;\n" "uniform mat4 projection;\n" "void main() {\n" " gl_Position = projection * vec4(vertex.xy, 0.0, 1.0);\n" " TexCoords = vertex.xy;\n" "}\n" Because we needn't calculate of texture coordinates for quad with the same textures size, but for text symbol we should calculate them. also, check correct texture coordinates in GLfloat vertices[6][4] = { { x, y + 32, 0.0, 0.0 }, { x, y, 0.0, 1.0 }, { x + 32, y, 1.0, 1.0 }, { x, y + 32, 0.0, 0.0 }, { x + 32, y, 1.0, 1.0 }, { x + 32, y + 32, 1.0, 0.0 }
  13. 1) Problem with Z coordinates for textured quad ? You can use the same float vertices[6][4] instead of float vertices[6][2] 2) vertex shader is waiting in vec4 vertex attribute, but you set glVertexAttribPointer(GL_ZERO, 2, GL_FLOAT, GL_FALSE, 2 * sizeof(GLfloat), GL_ZERO); You can remove duplicate code and use the common function for preparing VBO/VAO for textured quad and text symbol with different data.
  14. try to remove // glBindBuffer(GL_ARRAY_BUFFER, GL_ZERO); in if you use glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(vertices), vertices, GL_STATIC_DRAW); instead of glBufferData in printTexture with reduced size, is error reproduced ? Try to use separate VBO for text and print texture, because using the same buffer for different size is strange decision. Also for dynamic data you should use GL_DYNAMIC_DRAW
  15. GL_INVALID_VALUE is generated if offset or size is negative, or if together they define a region of memory that extends beyond the buffer object's allocated data store. Try to check size of vertex data in glBufferData(2 parameter) /glBufferSubData (3 parameter) if error still reproduced, you can create the Desktop version of project with OpenGL ES emulation and attach it to forum.
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!