Revision 2ab60f72
Added by Leszek Koltunski about 6 years ago
src/main/java/org/distorted/library/main/DistortedOutputSurface.java | ||
---|---|---|
162 | 162 |
createProjection(); |
163 | 163 |
} |
164 | 164 |
|
165 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
166 |
|
|
167 |
void error(String msg) |
|
168 |
{ |
|
169 |
int err = GLES31.glGetError(); |
|
170 |
|
|
171 |
if( err != GLES31.GL_NO_ERROR ) |
|
172 |
{ |
|
173 |
android.util.Log.e("surface", msg+" error: "+err); |
|
174 |
} |
|
175 |
} |
|
176 |
|
|
165 | 177 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
166 | 178 |
// Must be called from a thread holding OpenGL Context |
167 | 179 |
|
... | ... | |
173 | 185 |
|
174 | 186 |
// here bind the new SSBO and map it |
175 | 187 |
GLES31.glBindBuffer(GLES31.GL_SHADER_STORAGE_BUFFER, mSSBO[0]); |
188 |
error("pre1"); |
|
176 | 189 |
GLES31.glBufferData(GLES31.GL_SHADER_STORAGE_BUFFER, BUFFERING*mBufferSize*4 , null, GLES31.GL_DYNAMIC_READ); |
177 |
mSSBOBuffer = (ByteBuffer) GLES31.glMapBufferRange(GLES31.GL_SHADER_STORAGE_BUFFER, 0, BUFFERING*mBufferSize*4, GLES31.GL_MAP_WRITE_BIT | GLES31.GL_MAP_WRITE_BIT ); |
|
178 |
GLES31.glBindBufferBase(GLES31.GL_SHADER_STORAGE_BUFFER,1, mSSBO[0]); |
|
190 |
error("pre2"); |
|
191 |
mSSBOBuffer = (ByteBuffer) GLES31.glMapBufferRange(GLES31.GL_SHADER_STORAGE_BUFFER, 0, BUFFERING*mBufferSize*4, GLES31.GL_MAP_READ_BIT ); |
|
192 |
error("pre3"); |
|
193 |
GLES31.glBindBufferBase(GLES31.GL_SHADER_STORAGE_BUFFER,0, mSSBO[0]); |
|
194 |
error("pre4"); |
|
179 | 195 |
} |
180 | 196 |
|
181 | 197 |
mSurfaceID = mSurfaceCounter.returnNext(); |
Also available in: Unified diff
SSBO: something is working already, although we still get the 4 bytes back from the shader in reverse order ( so '17'=0x00000011 written by the shader becomes '285212672 = 0x11000000' )