aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar csmartdalton <csmartdalton@google.com>2016-06-03 08:50:54 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-06-03 08:50:54 -0700
commit1897cfd7a6e193b42ca95e830e9485f5201a995c (patch)
tree697ddd44873c615bce81250008735d2b47a9e40b
parentb73c24b01a411843a98d4ccab7a39341d927e7fd (diff)
Abandon offset support with texel buffers
We don't seem to require nonzero offsets for texel buffers at this point in time, and requiring this feature greatly reduces the number of desktop clients that can use texel buffers. If we find a use for offsets later we can always add it back as a separate feature. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2036953002 Review-Url: https://codereview.chromium.org/2036953002
-rw-r--r--include/gpu/GrBufferAccess.h8
-rw-r--r--src/gpu/gl/GrGLCaps.cpp2
-rw-r--r--src/gpu/gl/GrGLGpu.cpp20
-rw-r--r--src/gpu/gl/GrGLGpu.h4
-rw-r--r--src/gpu/gl/GrGLProgram.cpp2
5 files changed, 10 insertions, 26 deletions
diff --git a/include/gpu/GrBufferAccess.h b/include/gpu/GrBufferAccess.h
index 183d43d670..a5d8f0a684 100644
--- a/include/gpu/GrBufferAccess.h
+++ b/include/gpu/GrBufferAccess.h
@@ -20,24 +20,21 @@ public:
/**
* Must be initialized before adding to a GrProcessor's buffer access list.
*/
- void reset(intptr_t offsetInBytes, GrPixelConfig texelConfig, GrBuffer* buffer,
+ void reset(GrPixelConfig texelConfig, GrBuffer* buffer,
GrShaderFlags visibility = kFragment_GrShaderFlag) {
- fOffsetInBytes = offsetInBytes;
fTexelConfig = texelConfig;
fBuffer.set(SkRef(buffer), kRead_GrIOType);
fVisibility = visibility;
}
bool operator==(const GrBufferAccess& that) const {
- return fOffsetInBytes == that.fOffsetInBytes &&
- fTexelConfig == that.fTexelConfig &&
+ return fTexelConfig == that.fTexelConfig &&
this->buffer() == that.buffer() &&
fVisibility == that.fVisibility;
}
bool operator!=(const GrBufferAccess& that) const { return !(*this == that); }
- intptr_t offsetInBytes() const { return fOffsetInBytes; }
GrPixelConfig texelConfig() const { return fTexelConfig; }
GrBuffer* buffer() const { return fBuffer.get(); }
GrShaderFlags visibility() const { return fVisibility; }
@@ -48,7 +45,6 @@ public:
const GrGpuResourceRef* getProgramBuffer() const { return &fBuffer;}
private:
- intptr_t fOffsetInBytes;
GrPixelConfig fTexelConfig;
GrTGpuResourceRef<GrBuffer> fBuffer;
GrShaderFlags fVisibility;
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index 9aae7e5aef..14c03d70a7 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -758,7 +758,7 @@ void GrGLCaps::initGLSL(const GrGLContextInfo& ctxInfo) {
if (glslCaps->fTexelFetchSupport) {
if (kGL_GrGLStandard == standard) {
- glslCaps->fTexelBufferSupport = ctxInfo.version() >= GR_GL_VER(4, 3) &&
+ glslCaps->fTexelBufferSupport = ctxInfo.version() >= GR_GL_VER(3, 1) &&
ctxInfo.glslGeneration() >= k330_GrGLSLGeneration;
} else {
if (ctxInfo.version() >= GR_GL_VER(3, 2) &&
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index fe32556823..8aec4d684d 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -3248,11 +3248,9 @@ void GrGLGpu::bindTexture(int unitIdx, const GrTextureParams& params, bool allow
texture->setCachedTexParams(newTexParams, this->getResetTimestamp());
}
-void GrGLGpu::bindTexelBuffer(int unitIdx, intptr_t offsetInBytes, GrPixelConfig texelConfig,
- GrGLBuffer* buffer) {
+void GrGLGpu::bindTexelBuffer(int unitIdx, GrPixelConfig texelConfig, GrGLBuffer* buffer) {
SkASSERT(this->glCaps().canUseConfigWithTexelBuffer(texelConfig));
SkASSERT(unitIdx >= 0 && unitIdx < fHWBufferTextures.count());
- SkASSERT(offsetInBytes >= 0 && offsetInBytes < (intptr_t) buffer->glSizeInBytes());
BufferTexture& buffTex = fHWBufferTextures[unitIdx];
@@ -3271,22 +3269,14 @@ void GrGLGpu::bindTexelBuffer(int unitIdx, intptr_t offsetInBytes, GrPixelConfig
}
if (buffer->getUniqueID() != buffTex.fAttachedBufferUniqueID ||
- buffTex.fOffsetInBytes != offsetInBytes ||
- buffTex.fTexelConfig != texelConfig ||
- buffTex.fAttachedSizeInBytes != buffer->glSizeInBytes() - offsetInBytes) {
-
- size_t attachmentSizeInBytes = buffer->glSizeInBytes() - offsetInBytes;
+ buffTex.fTexelConfig != texelConfig) {
this->setTextureUnit(unitIdx);
- GL_CALL(TexBufferRange(GR_GL_TEXTURE_BUFFER,
- this->glCaps().configSizedInternalFormat(texelConfig),
- buffer->bufferID(),
- offsetInBytes,
- attachmentSizeInBytes));
+ GL_CALL(TexBuffer(GR_GL_TEXTURE_BUFFER,
+ this->glCaps().configSizedInternalFormat(texelConfig),
+ buffer->bufferID()));
- buffTex.fOffsetInBytes = offsetInBytes;
buffTex.fTexelConfig = texelConfig;
- buffTex.fAttachedSizeInBytes = attachmentSizeInBytes;
buffTex.fAttachedBufferUniqueID = buffer->getUniqueID();
if (this->glCaps().textureSwizzleSupport() &&
diff --git a/src/gpu/gl/GrGLGpu.h b/src/gpu/gl/GrGLGpu.h
index 06d4bd357b..e2e27d586a 100644
--- a/src/gpu/gl/GrGLGpu.h
+++ b/src/gpu/gl/GrGLGpu.h
@@ -60,7 +60,7 @@ public:
void bindTexture(int unitIdx, const GrTextureParams& params, bool allowSRGBInputs,
GrGLTexture* texture);
- void bindTexelBuffer(int unitIdx, intptr_t offsetInBytes, GrPixelConfig, GrGLBuffer*);
+ void bindTexelBuffer(int unitIdx, GrPixelConfig, GrGLBuffer*);
void generateMipmaps(const GrTextureParams& params, bool allowSRGBInputs, GrGLTexture* texture);
@@ -514,9 +514,7 @@ private:
GrGLuint fTextureID;
bool fKnownBound;
- intptr_t fOffsetInBytes;
GrPixelConfig fTexelConfig;
- size_t fAttachedSizeInBytes;
uint32_t fAttachedBufferUniqueID;
GrSwizzle fSwizzle;
};
diff --git a/src/gpu/gl/GrGLProgram.cpp b/src/gpu/gl/GrGLProgram.cpp
index 040c57de3a..a87aa5ad5f 100644
--- a/src/gpu/gl/GrGLProgram.cpp
+++ b/src/gpu/gl/GrGLProgram.cpp
@@ -159,7 +159,7 @@ void GrGLProgram::bindTextures(const GrProcessor& processor,
}
for (int i = 0; i < processor.numBuffers(); ++i) {
const GrBufferAccess& access = processor.bufferAccess(i);
- fGpu->bindTexelBuffer((*nextSamplerIdx)++, access.offsetInBytes(), access.texelConfig(),
+ fGpu->bindTexelBuffer((*nextSamplerIdx)++, access.texelConfig(),
static_cast<GrGLBuffer*>(access.buffer()));
}
}